SDL: Check for non-NULL icon for trays on Unix

From e6029401d922a9d2704f309bee2f2f8d19a0ec6e Mon Sep 17 00:00:00 2001
From: Semphris <[EMAIL REDACTED]>
Date: Mon, 10 Feb 2025 12:47:28 -0500
Subject: [PATCH] Check for non-NULL icon for trays on Unix

---
 src/tray/unix/SDL_tray.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/tray/unix/SDL_tray.c b/src/tray/unix/SDL_tray.c
index f10f92aa4e202..02b59436bcf3f 100644
--- a/src/tray/unix/SDL_tray.c
+++ b/src/tray/unix/SDL_tray.c
@@ -421,12 +421,14 @@ SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
         return NULL;
     }
 
-    if (!new_tmp_filename(tray)) {
-        SDL_free(tray);
-        return NULL;
-    }
+    if (icon) {
+        if (!new_tmp_filename(tray)) {
+            SDL_free(tray);
+            return NULL;
+        }
 
-    SDL_SaveBMP(icon, tray->icon_path);
+        SDL_SaveBMP(icon, tray->icon_path);
+    }
 
     tray->indicator = app_indicator_new(get_appindicator_id(), tray->icon_path,
                                         APP_INDICATOR_CATEGORY_APPLICATION_STATUS);