mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
Stop an infinite loop that occurs if you have questions all in the same category. Bug found by ltost.
This commit is contained in:
parent
1adea54304
commit
6d3257f5c7
@ -292,8 +292,10 @@ sub quizQuestion { # called from quizStart or delayed from quizAnswer
|
||||
if ($self->{'remainingQuestions'}->{$event->{'channel'}} != 0) {
|
||||
$self->{'remainingQuestions'}->{$event->{'channel'}}--;
|
||||
my $category = $self->{'questions'}->[$self->{'currentQuestion'}->{$event->{'channel'}}]->{'category'};
|
||||
while ($category eq $self->{'questions'}->[$self->{'currentQuestion'}->{$event->{'channel'}}]->{'category'}
|
||||
and my $try++ < keys %{$self->{'questions'}}) {
|
||||
my $try = 0;
|
||||
my $$questionCount = scalar keys %{$self->{'questions'}};
|
||||
while ($self->{'questions'}->[$self->{'currentQuestion'}->{$event->{'channel'}}]->{'category'} eq $category
|
||||
and $try++ < $questionCount) {
|
||||
$self->{'currentQuestion'}->{$event->{'channel'}} = $self->pickQuestion();
|
||||
}
|
||||
$self->{'questionsTime'}->{$event->{'channel'}} = time();
|
||||
|
Loading…
x
Reference in New Issue
Block a user