Forráskód Böngészése

Check for non-NULL icon for trays on Unix

Semphris 2 hónapja
szülő
commit
e6029401d9
1 módosított fájl, 7 hozzáadás és 5 törlés
  1. 7 5
      src/tray/unix/SDL_tray.c

+ 7 - 5
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);