mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Fix null pointer dereference when cancelling an RCT1 location dialog on Mac OS X.
To reproduce, run openrct2 on OSX, go to the options dialog, then to the bottom of the misc tab, select an RCT1 location. Then, cancel that dialog. This would trigger a null pointer dereference by returning std::string(nullptr).
This commit is contained in:
committed by
Michael Steenbeek
parent
1aed331928
commit
553e16144b
@@ -118,14 +118,14 @@ namespace OpenRCT2 { namespace Ui
|
||||
panel.canChooseFiles = false;
|
||||
panel.canChooseDirectories = true;
|
||||
panel.allowsMultipleSelection = false;
|
||||
utf8 *url = NULL;
|
||||
if ([panel runModal] == NSFileHandlingPanelOKButton)
|
||||
{
|
||||
NSString *selectedPath = panel.URL.path;
|
||||
const char *path = selectedPath.UTF8String;
|
||||
url = _strdup(path);
|
||||
return path;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user