[grilo] core: Fix possible crash when passing NULL options



commit 3ba699dd90ed5b99d77c444c134324e1f917d2ea
Author: Bastien Nocera <hadess hadess net>
Date:   Fri May 30 16:33:12 2014 +0200

    core: Fix possible crash when passing NULL options
    
    grl_operation_options_get_resolution_flags() shouldn't
    crash when the options passed are NULL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724308

 src/grl-operation-options.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/grl-operation-options.c b/src/grl-operation-options.c
index 73c9774..ea8f7bd 100644
--- a/src/grl-operation-options.c
+++ b/src/grl-operation-options.c
@@ -492,8 +492,14 @@ grl_operation_options_set_resolution_flags (GrlOperationOptions *options,
 GrlResolutionFlags
 grl_operation_options_get_resolution_flags (GrlOperationOptions *options)
 {
-  const GValue *value  = g_hash_table_lookup (options->priv->data,
-                                              GRL_OPERATION_OPTION_RESOLUTION_FLAGS);
+  const GValue *value;
+
+  if (options)
+    value = g_hash_table_lookup (options->priv->data,
+                                 GRL_OPERATION_OPTION_RESOLUTION_FLAGS);
+  else
+    value = NULL;
+
   if (value)
     return g_value_get_uint (value);
 


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