add extra safety check

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@36504 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-04-11 12:56:23 +00:00
parent ab2a9854d9
commit d36af01836

View file

@ -396,14 +396,15 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
if (NSNotFound != index) if (NSNotFound != index)
{ {
EcAlarm *old = [a objectAtIndex: index]; EcAlarm *old = [a objectAtIndex: index];
int notificationID = [old notificationID];
severity = [old perceivedSeverity]; severity = [old perceivedSeverity];
if (severity <= alertAlarmThreshold) if (severity <= alertAlarmThreshold && notificationID > 0)
{ {
NSDictionary *info; NSDictionary *info;
NSString *key; NSString *key;
key = [NSString stringWithFormat: @"%d", [old notificationID]]; key = [NSString stringWithFormat: @"%d", notificationID];
if (nil != (info = [lastAlertInfo objectForKey: key])) if (nil != (info = [lastAlertInfo objectForKey: key]))
{ {