Pārlūkot izejas kodu

dialog: Make sure we don't underflow a string in Cocoa backend.

Fixes #13014.
Ryan C. Gordon 1 mēnesi atpakaļ
vecāks
revīzija
27caa57695
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      src/dialog/cocoa/SDL_cocoadialog.m

+ 1 - 1
src/dialog/cocoa/SDL_cocoadialog.m

@@ -157,7 +157,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
     // Keep behavior consistent with other platforms
     [dialog setAllowsOtherFileTypes:YES];
 
-    if (default_location) {
+    if (default_location && *default_location) {
         char last = default_location[SDL_strlen(default_location) - 1];
         NSURL* url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:default_location]];
         if (last == '/') {