[gnome-photos] base-manager: Watch out for NULL ids



commit 094c102e017752a9af717d30d825f83575417b8b
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Feb 27 16:03:11 2014 +0100

    base-manager: Watch out for NULL ids
    
    ... because g_str_hash can not handle NULL.
    
    Fixes: https://bugzilla.gnome.org/725327

 src/photos-base-manager.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-base-manager.c b/src/photos-base-manager.c
index 0911205..9c88898 100644
--- a/src/photos-base-manager.c
+++ b/src/photos-base-manager.c
@@ -317,7 +317,15 @@ photos_base_manager_get_filter (PhotosBaseManager *self, gint flags)
 GObject *
 photos_base_manager_get_object_by_id (PhotosBaseManager *self, const gchar *id)
 {
-  return g_hash_table_lookup (self->priv->objects, id);
+  GObject *ret_val = NULL;
+
+  if (id == NULL)
+    goto out;
+
+  ret_val = g_hash_table_lookup (self->priv->objects, id);
+
+ out:
+  return ret_val;
 }
 
 


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