OS X: don't crash in GetSaveFile() if default extension is invalid.

pull/97/head
whitequark 2016-10-21 20:08:09 +04:00
parent 90987d3ee4
commit 345c982b3b
1 changed files with 3 additions and 0 deletions

View File

@ -792,6 +792,9 @@ bool SolveSpace::GetSaveFile(std::string *file, const std::string &defExtension,
if(defExtension != "") { if(defExtension != "") {
extensionIndex = [extensions indexOfObject: extensionIndex = [extensions indexOfObject:
[NSString stringWithUTF8String:defExtension.c_str()]]; [NSString stringWithUTF8String:defExtension.c_str()]];
if(extensionIndex == -1) {
extensionIndex = 0;
}
} }
[button selectItemAtIndex:extensionIndex]; [button selectItemAtIndex:extensionIndex];