[grilo-plugins] lua-factory: throw error on bad grl.callback



commit fe1a534461c2c280f78d69c353b884353f7a5a12
Author: Victor Toso <me victortoso com>
Date:   Wed Jul 8 10:18:59 2015 +0200

    lua-factory: throw error on bad grl.callback
    
    Throw luaL_error instead of system error on broken sources. This
    facilitate the developer to find bad usage of grl.callback on lua
    sources.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750955

 src/lua-factory/grl-lua-library.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c
index b936370..ef3deae 100644
--- a/src/lua-factory/grl-lua-library.c
+++ b/src/lua-factory/grl-lua-library.c
@@ -984,7 +984,11 @@ grl_l_callback (lua_State *L)
 
   nparam = lua_gettop (L);
   os = grl_lua_library_get_current_operation (L);
-  g_return_val_if_fail (os != NULL, 0);
+  if (os == NULL) {
+    luaL_error (L, "Source is broken as grl.callback() was called "
+                "after last operation has been finalized");
+    return 0;
+  }
 
   media = (os->op_type == LUA_RESOLVE) ? os->media : NULL;
   if (nparam > 0) {


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