report errors if lua rtgroup accept function failed 30/8330/1
authorJaska Uimonen <jaska.uimonen@helsinki.fi>
Thu, 15 Aug 2013 16:20:12 +0000 (19:20 +0300)
committerJaska Uimonen <jaska.uimonen@helsinki.fi>
Fri, 16 Aug 2013 06:19:02 +0000 (09:19 +0300)
murphy/scripting.c

index 317ccd2..f3e616d 100644 (file)
@@ -27,6 +27,7 @@
 #include <pulsecore/core-util.h>
 
 #include <murphy/common/macros.h>
+#include <murphy/common/mm.h>
 #include <murphy/core/lua-utils/object.h>
 #include <murphy/core/lua-utils/funcbridge.h>
 #include <murphy/core/lua-utils/strarray.h>
@@ -1411,8 +1412,14 @@ static pa_bool_t rtgroup_accept(struct userdata *u,
         args[0].pointer = rtgs;
         args[1].pointer = node->scripting;
 
-        if (!mrp_funcbridge_call_from_c(L, rtgs->accept, "oo",args, &rt,&rv))
-            pa_log("failed to call accept function");
+        if (!mrp_funcbridge_call_from_c(L, rtgs->accept, "oo",args, &rt,&rv)) {
+            if (rt != MRP_FUNCBRIDGE_STRING)
+                pa_log("call to accept function failed");
+            else {
+                pa_log("call to accept function failed: %s", rv.string);
+                mrp_free((void *)rv.string);
+            }
+        }
         else {
             if (rt != MRP_FUNCBRIDGE_BOOLEAN)
                 pa_log("accept function returned invalid type");