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

Fixes #13014.
This commit is contained in:
Ryan C. Gordon
2025-07-21 16:02:42 -04:00
parent b2d152e51f
commit 27caa57695

View File

@@ -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 == '/') {