SDL: notification: Check the icon string before duplicating

From a7ade74cf1315e2cf51c0f476edd33661c32bc4b Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Tue, 23 Jun 2026 14:28:17 -0400
Subject: [PATCH] notification: Check the icon string before duplicating

Fixes #15877
---
 src/notification/unix/SDL_dbusnotification.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/notification/unix/SDL_dbusnotification.c b/src/notification/unix/SDL_dbusnotification.c
index d274e625a92dd..ab7a3cb308e4b 100644
--- a/src/notification/unix/SDL_dbusnotification.c
+++ b/src/notification/unix/SDL_dbusnotification.c
@@ -595,13 +595,13 @@ static const char *GetIconURI()
     SDL_PropertiesID props = SDL_GetGlobalProperties();
     const char *icon = SDL_GetStringProperty(props, SDL_PROP_GLOBAL_NOTIFICATION_HEADER_ICON_STRING, NULL);
     if (icon && realpath(icon, full_path)) {
-        size_t len = SDL_strlen(full_path) + 8;
+        const size_t len = SDL_strlen(full_path) + 8;
         icon_uri = SDL_malloc(len);
         if (icon_uri) {
             SDL_strlcpy(icon_uri, "file://", len);
             SDL_strlcat(icon_uri, full_path, len);
         }
-    } else {
+    } else if (icon) {
         // If the path can't be retrieved, assume it is the system name of an icon.
         icon_uri = SDL_strdup(icon);
     }