comparison skillbot.pl @ 54:9ed1e53a8d3e

Safety checks in hash sort
author Dominic Cleal <dominic@computerkb.co.uk>
date Sat, 27 Dec 2008 23:45:55 +0000
parents d5872370102a
children c5ce2fff9b85
comparison
equal deleted inserted replaced
53:d5872370102a 54:9ed1e53a8d3e
229 if ($msg =~ /^\!eta(\s+(.+))?/i) { 229 if ($msg =~ /^\!eta(\s+(.+))?/i) {
230 my $found = 0; 230 my $found = 0;
231 231
232 my @filtered = 232 my @filtered =
233 sort { 233 sort {
234 $a->{skill}->finish_time <=> $b->{skill}->finish_time 234 (defined $a->{skill} && defined $b->{skill})
235 ? $a->{skill}->finish_time <=> $b->{skill}->finish_time
236 : 0
235 } 237 }
236 grep { 238 grep {
237 ((defined $2 && (lc($_->{char}->name) eq lc($2) 239 ((defined $2 && (lc($_->{char}->name) eq lc($2)
238 || lc($2) eq 'all' || lc($2) eq '*')) 240 || lc($2) eq 'all' || lc($2) eq '*'))
239 || (!defined $2 && $_->{nick} eq $their_nick)) 241 || (!defined $2 && $_->{nick} eq $their_nick))