[gnome-contacts/gnome-3-38] fakepersona: Watch out casting a GValue
- From: Niels De Graef <nielsdg src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-contacts/gnome-3-38] fakepersona: Watch out casting a GValue
 
- Date: Sat,  7 Nov 2020 10:45:23 +0000 (UTC)
 
commit 3439044223ca295962ab361dac16b6412800f114
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
    
    (cherry picked from commit d591157de785e6026daf7ce4840fe9bc4976ece5)
 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]