[gnome-contacts] Don't crash if new linking persona doesn't support Names



commit 234eed7ed11d4eb59088224b49fdaf6c64cea528
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Oct 20 18:19:32 2011 +0200

    Don't crash if new linking persona doesn't support Names
    
    I've seen this in bugreports. Not sure how it could happen, but we
    should at least not crash.

 src/contacts-linking.vala |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/contacts-linking.vala b/src/contacts-linking.vala
index a9962bf..2a2f0ce 100644
--- a/src/contacts-linking.vala
+++ b/src/contacts-linking.vala
@@ -454,7 +454,9 @@ namespace Contacts {
 	write_persona = yield main.store.aggregator.primary_store.add_persona_from_details (details);
 	linkables = main_linkables;
 	linkables.add_all (other_linkables);
-	yield (write_persona as NameDetails).change_full_name (main.display_name);
+	var name_details = write_persona as NameDetails;
+	if (name_details != null)
+	  yield name_details.change_full_name (main.display_name);
       } catch (GLib.Error e) {
 	main.set_data ("contacts-master-at-join", false);
 	warning ("Unable to create new persona when linking: %s\n", e.message);



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