From 08a347607483604a4f0b9e8e4d33040160be7578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 18 Apr 2013 20:31:48 +0200 Subject: [PATCH 1/2] 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 5d2686b..5edfa5b 100644 --- a/src/polkitbackend/polkitbackendjsauthority.c +++ b/src/polkitbackend/polkitbackendjsauthority.c @@ -1304,20 +1304,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 = dJS_GetStringCharsZ (authority->priv->cx, ret_jsstr); ret_str = g_utf16_to_utf8 (ret_utf16, -1, NULL, NULL, &error); if (ret_str == NULL) -- 1.8.1.4