From 36eb156d7dc9ce5aa23e7c2e890c550b2896e311 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 23 Sep 2017 03:17:32 +0000 Subject: [PATCH] macOS: Fix crash in startup window when no game data is found. git-svn-id: https://svn.eduke32.com/eduke32@6448 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/startosx.game.mm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/duke3d/src/startosx.game.mm b/source/duke3d/src/startosx.game.mm index c785f6f99..45f267032 100644 --- a/source/duke3d/src/startosx.game.mm +++ b/source/duke3d/src/startosx.game.mm @@ -527,14 +527,18 @@ static struct { [[gameList documentView] setDataSource:gamelistsrc]; [[gameList documentView] deselectAll:nil]; - int row = [gamelistsrc findIndexForGrpname:[NSString stringWithUTF8String:settings.grp->filename]]; - if (row >= 0) { - [[gameList documentView] scrollRowToVisible:row]; + if (settings.grp) + { + int row = [gamelistsrc findIndexForGrpname:[NSString stringWithUTF8String:settings.grp->filename]]; + if (row >= 0) + { + [[gameList documentView] scrollRowToVisible:row]; #if defined MAC_OS_X_VERSION_10_3 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3 - [[gameList documentView] selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; + [[gameList documentView] selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; #else - [[gameList documentView] selectRow:row byExtendingSelection:NO]; + [[gameList documentView] selectRow:row byExtendingSelection:NO]; #endif + } } [cancelButton setEnabled:true];