diff --git a/ChangeLog b/ChangeLog index cc6abfdcf..199af3821 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * Source/NSWorkspace.m: In GSLaunched() be more defensive and don't assume that the values which should be present in the notification userinfo dictionry really are there. + * Source/NSApplication.m: Code more defensively setting up + notification info. 2006-02-02 Richard Frith-Macdonald diff --git a/Source/NSApplication.m b/Source/NSApplication.m index b106b447a..d98044ac4 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -3337,16 +3337,46 @@ image.

See Also: -applicationIconImage

- (NSDictionary*) _notificationUserInfo { + NSString *path; + NSString *port; NSNumber *processIdentifier; NSDictionary *userInfo; processIdentifier = [NSNumber numberWithInt: [[NSProcessInfo processInfo] processIdentifier]]; - userInfo = [NSDictionary dictionaryWithObjectsAndKeys: - [(GSServicesManager*)_listener port], @"NSApplicationName", - [[NSBundle mainBundle] bundlePath], @"NSApplicationPath", - processIdentifier, @"NSApplicationProcessIdentifier", - nil]; + port = [(GSServicesManager*)_listener port]; + path = [[NSBundle mainBundle] bundlePath]; + if (port == nil) + { + if (path == nil) + { + userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + processIdentifier, @"NSApplicationProcessIdentifier", + nil]; + } + else + { + userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + path, @"NSApplicationPath", + processIdentifier, @"NSApplicationProcessIdentifier", + nil]; + } + } + else if (path == nil) + { + userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + port, @"NSApplicationName", + processIdentifier, @"NSApplicationProcessIdentifier", + nil]; + } + else + { + userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + port, @"NSApplicationName", + path, @"NSApplicationPath", + processIdentifier, @"NSApplicationProcessIdentifier", + nil]; + } return userInfo; }