Commits

Peter Hosey  committed 07b66c6

Fixed a crash on ticket load reported by Hannes Mannerhiem on the Growl discussion list.

Somehow, a ticket ended up in Mannerhiem's Tickets directory without an application name. Since Growl expected to find one, it crashed. We now log a message to the Console instead.

  • Participants
  • Parent commits 2cbf094
  • Branches default

Comments (0)

Files changed (1)

File Core/Source/GrowlTicketController.m

 			GrowlApplicationTicket *newTicket = [[GrowlApplicationTicket alloc] initTicketFromPath:filename];
 			if (newTicket) {
 				NSString *applicationName = [newTicket applicationName];
-				
-				/* Growl used to generate a ticket for itself to display notifcations, but 
-				 * but this has been removed for 1.1, referencing ticket #547. Thus we have
-				 * the ticket loader remove the file if found */
-				if([applicationName isEqual:@"Growl"])
-				{
-					[self removeTicketForApplicationName:@"Growl"];
-					[mgr removeFileAtPath:filename handler:nil];
+				if (!applicationName) {
+					NSLog(@"Invalid ticket (no application name inside): %@", [filename lastPathComponent]);
+				} else {
+					/* Growl used to generate a ticket for itself to display notifcations, but 
+				 	 * but this has been removed for 1.1, referencing ticket #547. Thus we have
+				 	 * the ticket loader remove the file if found */
+					if([applicationName isEqual:@"Growl"])
+					{
+						[self removeTicketForApplicationName:@"Growl"];
+						[mgr removeFileAtPath:filename handler:nil];
+					}
+
+					/*if we haven't already loaded a ticket for this application,
+				 	 *	or if we're clobbering already-loaded tickets,
+				 	 *	set this ticket in the dictionary.
+				 	 */
+					if (clobber || ![ticketsByApplicationName objectForKey:applicationName])
+						[ticketsByApplicationName setObject:newTicket forKey:applicationName];
+
+					[newTicket release];
 				}
-
-				/*if we haven't already loaded a ticket for this application,
-				 *	or if we're clobbering already-loaded tickets,
-				 *	set this ticket in the dictionary.
-				 */
-				if (clobber || ![ticketsByApplicationName objectForKey:applicationName])
-					[ticketsByApplicationName setObject:newTicket forKey:applicationName];
-
-				[newTicket release];
 			}
 		}
 	}