c51dd0
--- a/src/polkit/polkitsystembusname.c
c51dd0
+++ b/src/polkit/polkitsystembusname.c
c51dd0
@@ -435,6 +435,9 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName           *system_bus
c51dd0
   while (!((data.retrieved_uid && data.retrieved_pid) || data.caught_error))
c51dd0
     g_main_context_iteration (tmp_context, TRUE);
c51dd0
 
c51dd0
+  if (data.caught_error)
c51dd0
+    goto out;
c51dd0
+
c51dd0
   if (out_uid)
c51dd0
     *out_uid = data.uid;
c51dd0
   if (out_pid)
c51dd0