From cf5e1561a94d91d6e15202eaf5c291ed4f348554 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Thu, 27 Nov 2008 06:25:27 +0000 Subject: [PATCH] * Framework/PCProjectBrowser.m: Check return value of [NSWorkspace getInfoForFile:application:type:]. Corrects crash when no editor is available for a type. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@27144 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Framework/PCProjectBrowser.m | 18 +++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7833a65..92d9d8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-11-27 01:29-EST Gregory John Casamento + + * Framework/PCProjectBrowser.m: Check return value of + [NSWorkspace getInfoForFile:application:type:]. Corrects crash when + no editor is available for a type. + 2008-10-25 20:48-EDT Gregory John Casamento * Version: 0.5 diff --git a/Framework/PCProjectBrowser.m b/Framework/PCProjectBrowser.m index 0058eb8..e5740db 100644 --- a/Framework/PCProjectBrowser.m +++ b/Framework/PCProjectBrowser.m @@ -418,21 +418,25 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification"; if ([self nameOfSelectedFile] != nil) { -/* PCLogInfo(self, @"{doubleClick} filePath: %@", filePath);*/ + BOOL foundApp = NO; + // PCLogInfo(self, @"{doubleClick} filePath: %@", filePath);*/ workspace = [NSWorkspace sharedWorkspace]; - [workspace getInfoForFile:filePath application:&appName type:&type]; -// NSLog (@"Open file: %@ with app: %@", filePath, appName); + foundApp = [workspace getInfoForFile:filePath + application:&appName type:&type]; + // NSLog (@"Open file: %@ with app: %@", filePath, appName); // If 'Editor' role was set in .GNUstepExtPrefs application // name will be returned according that setting. Otherwise // 'ProjectCenter.app' will be returned accoring to NSTypes // from Info-gnustep.plist file of PC. - if (appName == nil || - [appName isEqualToString:@"ProjectCenter.app"]) + if(foundApp == NO) { - [[project projectEditor] openEditorForCategoryPath:[browser path] - windowed:YES]; + if (appName == nil || [appName isEqualToString:@"ProjectCenter.app"]) + { + [[project projectEditor] openEditorForCategoryPath:[browser path] + windowed:YES]; + } } else {