[geary/mjog/fix-contact-store-crash] Fix crash when updating contacts with null names



commit 96ff4d290e225e8a43e46e380c2de39d0a214f5c
Author: Michael Gratton <mike vee net>
Date:   Wed Oct 30 22:44:51 2019 +1100

    Fix crash when updating contacts with null names

 src/engine/common/common-contact-store-impl.vala | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/engine/common/common-contact-store-impl.vala 
b/src/engine/common/common-contact-store-impl.vala
index 38825a3f..cf0cfc97 100644
--- a/src/engine/common/common-contact-store-impl.vala
+++ b/src/engine/common/common-contact-store-impl.vala
@@ -149,11 +149,21 @@ internal class Geary.ContactStoreImpl : ContactStore, BaseObject {
               flags = excluded.flags,
               highest_importance = excluded.highest_importance
         """);
-        stmt.bind_string(0, updated.normalized_email);
-        stmt.bind_string(1, updated.email.make_valid());
-        stmt.bind_string(2, updated.real_name.make_valid());
-        stmt.bind_string(3, updated.flags.serialize());
-        stmt.bind_int(4, updated.highest_importance);
+        stmt.bind_string(
+            0, updated.normalized_email
+        );
+        stmt.bind_string(
+            1, updated.email.make_valid()
+        );
+        stmt.bind_string(
+            2, updated.real_name != null ? updated.real_name.make_valid() : null
+        );
+        stmt.bind_string(
+            3, updated.flags.serialize()
+        );
+        stmt.bind_int(
+            4, updated.highest_importance
+        );
 
         stmt.exec(cancellable);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]