[gnome-contacts/wip/nielsdg/fix-critical-on-new: 4/4] fakepersona: Watch out casting a GValue




commit d591157de785e6026daf7ce4840fe9bc4976ece5
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Nov 2 21:59:00 2020 +0100

    fakepersona: Watch out casting a GValue
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-contacts/-/issues/188

 src/contacts-fake-persona-store.vala | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/contacts-fake-persona-store.vala b/src/contacts-fake-persona-store.vala
index ca6836b5..7a5d458a 100644
--- a/src/contacts-fake-persona-store.vala
+++ b/src/contacts-fake-persona-store.vala
@@ -106,7 +106,9 @@ PostalAddressDetails
   public LoadableIcon? avatar {
     get {
       unowned Value? value = this.properties.get ("avatar");
-      return (LoadableIcon?) value;
+      // Casting a Value internally makes it use g_value_get_object(),
+      // which is of course not allowed for a NULL value
+      return (value != null)? (LoadableIcon?) value : null;
     }
     set {
       this.properties.set ("avatar", value);


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