1
0
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:
Sjors Gielen
2017-07-14 01:12:03 +02:00
committed by Michael Steenbeek
parent 1aed331928
commit 553e16144b

View File

@@ -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;
}
}