From d8970ca6b4ae1bf76c0b02cdbeef7f739ddf67eb Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 28 Nov 2011 15:42:13 -0500 Subject: [PATCH] [#179] Fixed a crash under Cocoa when deleting many folders at once. --- cocoa/base/DirectoryPanel.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cocoa/base/DirectoryPanel.m b/cocoa/base/DirectoryPanel.m index dbe7c45f..f2f3aeaf 100644 --- a/cocoa/base/DirectoryPanel.m +++ b/cocoa/base/DirectoryPanel.m @@ -101,7 +101,6 @@ http://www.hardcoded.net/licenses/bsd_license { [[self window] makeKeyAndOrderFront:nil]; [[outline py] removeSelectedDirectory]; - [outlineView setNeedsDisplay:YES]; [self refreshRemoveButtonText]; } @@ -131,10 +130,12 @@ http://www.hardcoded.net/licenses/bsd_license } [removeButton setEnabled:YES]; NSIndexPath *path = [outline selectedIndexPath]; - NSInteger state = [outline intProperty:@"state" valueAtPath:path]; - BOOL shouldDisplayArrow = ([path length] > 1) && (state == 2); - NSString *imgName = shouldDisplayArrow ? @"NSGoLeftTemplate" : @"NSRemoveTemplate"; - [removeButton setImage:[NSImage imageNamed:imgName]]; + if (path != nil) { + NSInteger state = [outline intProperty:@"state" valueAtPath:path]; + BOOL shouldDisplayArrow = ([path length] > 1) && (state == 2); + NSString *imgName = shouldDisplayArrow ? @"NSGoLeftTemplate" : @"NSRemoveTemplate"; + [removeButton setImage:[NSImage imageNamed:imgName]]; + } } /* Delegate */