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