From 345c982b3b9de7a9bbd9c352ed1d6108da181382 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 21 Oct 2016 20:08:09 +0400 Subject: [PATCH] OS X: don't crash in GetSaveFile() if default extension is invalid. --- src/platform/cocoamain.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/cocoamain.mm b/src/platform/cocoamain.mm index d9c12654..9838058a 100644 --- a/src/platform/cocoamain.mm +++ b/src/platform/cocoamain.mm @@ -792,6 +792,9 @@ bool SolveSpace::GetSaveFile(std::string *file, const std::string &defExtension, if(defExtension != "") { extensionIndex = [extensions indexOfObject: [NSString stringWithUTF8String:defExtension.c_str()]]; + if(extensionIndex == -1) { + extensionIndex = 0; + } } [button selectItemAtIndex:extensionIndex];