[grilo-plugins] lua-factory: Fix may_resolve with NULL media



commit 1a21bfee850b4b0670dcc573f6f7a524ea831ed7
Author: Sebastian Keller <sebastian-keller gmx de>
Date:   Mon Feb 9 21:27:57 2015 +0100

    lua-factory: Fix may_resolve with NULL media
    
    grl_lua_factory_source_may_resolve might be called with media being NULL
    (via expand_operation_keys in grl-source.c for example). Currently this
    case is not handled properly and may_resolve calls grl_data_has_key
    which results in a critical warning because media is NULL.
    
    This is one of the sources of some of the critical warnings when running
    gnome-music.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744353

 src/lua-factory/grl-lua-factory.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-factory.c b/src/lua-factory/grl-lua-factory.c
index 2f3c25a..cfa950e 100644
--- a/src/lua-factory/grl-lua-factory.c
+++ b/src/lua-factory/grl-lua-factory.c
@@ -1182,6 +1182,13 @@ grl_lua_factory_source_may_resolve (GrlSource *source,
     return FALSE;
   }
 
+  /* If no media is given the caller wants to know all required keys for this source */
+  if (media == NULL) {
+    if (missing_keys)
+      *missing_keys = g_list_copy (lua_source->priv->resolve_keys);
+    return FALSE;
+  }
+
   /* Verify if the source resolve type and media type match */
   res_type = lua_source->priv->resolve_type;
   if ((GRL_IS_MEDIA_BOX (media) && (res_type != GRL_MEDIA_TYPE_ALL))


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