diff --git a/modules/module-simple-policy.c b/modules/module-simple-policy.c
index 9e053d677d5bfa7dc22c468af906e89a4b28db74..9aa5bea73f2dfcb346e1d62bd9ce89ee6b449af0 100644
--- a/modules/module-simple-policy.c
+++ b/modules/module-simple-policy.c
@@ -294,8 +294,8 @@ simple_policy_find_endpoint (WpPolicy *policy, GVariant *props,
   }
 
   /* If not found, return the first endpoint */
-  ep = (ptr_array->len > 1) ? g_ptr_array_index (ptr_array, 0) : NULL;
-  return g_object_ref (ep);
+  return (ptr_array->len > 1) ?
+    g_object_ref (g_ptr_array_index (ptr_array, 0)) : NULL;
 }
 
 static void