[grilo-plugins] lua-factory: Fix warnings when resolution fails



commit cf34c76278ec1cc4e5c852c885b48b18527cfcf0
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Feb 28 13:52:10 2014 +0100

    lua-factory: Fix warnings when resolution fails
    
    If the resolution fails, or the media passed from the callback
    function is not in the right format, we need to pass back the
    untouched original media, not NULL.

 src/lua-factory/grl-lua-library.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c
index 9d14943..631c779 100644
--- a/src/lua-factory/grl-lua-library.c
+++ b/src/lua-factory/grl-lua-library.c
@@ -189,7 +189,7 @@ grl_util_build_media (lua_State *L,
     if (!lua_isnil (L, 1))
       GRL_DEBUG ("Media in wrong format (neither nil or table).");
 
-    return NULL;
+    return user_media;
   }
 
   if (media == NULL) {
@@ -677,8 +677,8 @@ grl_l_callback (lua_State *L)
 
   nparam = lua_gettop (L);
   os = grl_lua_library_load_operation_data (L);
+  media = (os->op_type == LUA_RESOLVE) ? os->media : NULL;
   if (nparam > 0) {
-    media = (os->op_type == LUA_RESOLVE) ? os->media : NULL;
     media = grl_util_build_media (L, media);
     count = (lua_isnumber (L, 2)) ? lua_tonumber (L, 2) : 0;
   }


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