SDL: tray: Don't call g_object_unref(NULL)

From bba066c44ce2e106cc73c1d978036872db66f75e Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Tue, 7 Jan 2025 20:35:06 +0000
Subject: [PATCH] tray: Don't call g_object_unref(NULL)

g_object_unref() only accepts valid object instances.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 src/tray/unix/SDL_tray.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/tray/unix/SDL_tray.c b/src/tray/unix/SDL_tray.c
index de2ab4b2c7ae9..c2635665eb558 100644
--- a/src/tray/unix/SDL_tray.c
+++ b/src/tray/unix/SDL_tray.c
@@ -671,7 +671,9 @@ void SDL_DestroyTray(SDL_Tray *tray)
         SDL_RemovePath(tray->icon_path);
     }
 
-    g_object_unref(tray->indicator);
+    if (tray->indicator) {
+        g_object_unref(tray->indicator);
+    }
 
     SDL_free(tray);