* 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
This commit is contained in:
Gregory John Casamento 2008-11-27 06:25:27 +00:00
parent e2fd1153ef
commit cf5e1561a9
2 changed files with 17 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2008-11-27 01:29-EST Gregory John Casamento <greg_casamento@yahoo.com>
* 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 <greg_casamento@yahoo.com>
* Version: 0.5

View file

@ -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
{