changeset 39:4dd6009b0d2a

Deleting timer ID if it's already been cancelled
author Dominic Cleal <dominic@computerkb.co.uk>
date Sun, 07 Dec 2008 14:49:43 +0000
parents a8b60d2968b2
children 19cc55690fd7
files skillbot.pl
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/skillbot.pl	Sun Dec 07 11:52:44 2008 +0000
+++ b/skillbot.pl	Sun Dec 07 14:49:43 2008 +0000
@@ -462,14 +462,19 @@
 	{
 		# If the char was training before and now has stopped then cancel
 		# the announcement
-		del_one_shot_timer($f->{timer}) if defined $f->{timer};
+		if defined $f->{timer} {
+			del_one_shot_timer($f->{timer});
+			delete $f->{timer};
+		}
 		return;
 	}
 
 	# Check for changes in the skill, skip or cancel announcement
 	if (defined $f->{skill}) {
 		return if $skill->id eq $f->{skill}->id;
+
 		del_one_shot_timer($f->{timer});
+		delete $f->{timer};
 	}
 
 	my $finish = $skill->finish_time - time();