From 482384808d02037edec92d5a454277340e99df89 Mon Sep 17 00:00:00 2001 From: Marius Halden Date: Sat, 14 Feb 2015 07:59:25 +0100 Subject: Check for empty scoreboard after splitting it up --- stats.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stats.pl b/stats.pl index 9643de9..4614b3f 100755 --- a/stats.pl +++ b/stats.pl @@ -37,7 +37,7 @@ my @group_names = (); my $content = get($score_url); if (!defined($content) || !$content || length $content < 1) { print STDERR "Could not fetch scoreboard!"; - exit 1 + exit 1; } my $now = `date +%Y%m%d-%H%M%S`; @@ -48,6 +48,11 @@ close FH; my @content = split /^-+$/m, $content; shift @content; +if (scalar @content < 1) { + print STDERR, "Scoreboard seems to be empty!"; + exit 1; +} + for my $section (@content) { my ($position, $user, $balance, $endpoint, $time_up, $time_maint, $time_down) = (undef); -- cgit v1.2.3