From 2da44762df6125cc050747e51d0841929578fd7a Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Thu, 20 Jun 2019 12:58:11 +0300
Subject: [PATCH] m-simple-policy: find_endpoint: ref the endpoint only if it's
 not NULL

---
 modules/module-simple-policy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/module-simple-policy.c b/modules/module-simple-policy.c
index 9e053d67..9aa5bea7 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
-- 
GitLab