From 8085a29c67c4a6e1f58f8975e0f7426d09d0fa99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 18 Apr 2013 20:31:48 +0200 Subject: [PATCH] Fix handling of null returned from _runRules https://bugs.freedesktop.org/show_bug.cgi?id=63575 --- src/polkitbackend/polkitbackendjsauthority.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c index 3eeca21..0dd9548 100644 --- a/src/polkitbackend/polkitbackendjsauthority.c +++ b/src/polkitbackend/polkitbackendjsauthority.c @@ -1188,20 +1188,20 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu goto out; } - if (!JSVAL_IS_STRING (rval) && !JSVAL_IS_NULL (rval)) + if (JSVAL_IS_NULL (rval)) { - g_warning ("Expected a string"); + /* this fine, means there was no match, use implicit authorizations */ + good = TRUE; goto out; } - ret_jsstr = JSVAL_TO_STRING (rval); - if (ret_jsstr == NULL) + if (!JSVAL_IS_STRING (rval)) { - /* this fine, means there was no match, use implicit authorizations */ - good = TRUE; + g_warning ("Expected a string"); goto out; } + ret_jsstr = JSVAL_TO_STRING (rval); ret_utf16 = JS_GetStringCharsZ (authority->priv->cx, ret_jsstr); ret_str = g_utf16_to_utf8 (ret_utf16, -1, NULL, NULL, &error); if (ret_str == NULL) -- 2.7.4