From b2080e1178ea401d4aba8f9b9ef33875671d2b33 Mon Sep 17 00:00:00 2001 From: Dominic Hargreaves Date: Thu, 10 Sep 2015 14:25:26 +0100 Subject: [PATCH] jenkins_: Fix uninitialized values warning with unmapped states --- plugins/jenkins/jenkins_ | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/jenkins/jenkins_ b/plugins/jenkins/jenkins_ index edab804f..d60ef71c 100644 --- a/plugins/jenkins/jenkins_ +++ b/plugins/jenkins/jenkins_ @@ -134,7 +134,11 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) { my $result = `$cmd/api/json`; my $parsed = decode_json($result); foreach my $cur(@{$parsed->{'jobs'}}) { - $counts{$cur->{'color'}} += 1; + if (defined $states{$cur->{'color'}}) { + $counts{$cur->{'color'}} += 1; + } else { + warn "Ignoring unknown color " . $cur->{'color'} . "\n" + } } foreach my $status (keys %counts) {