summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-05-06 17:40:51 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2019-05-07 12:59:44 +0000
commit64abf60ae196bd3ad59531f48d2e2c78efa5987c (patch)
treedf1486c0f3737b39d549cd314d0bc7f1dc3f2c84
parenta2e59d2879f1071fca7345e5888927cdcc64c9a0 (diff)
Avoid warning on taking length of undefined list
Recently added check for fatuous sanity review tested for empty comments with int($$verdict{comments}) == 0 but it's possible that $$verdict{comments} is undefined; when it is, we get a warning here: Use of uninitialized value in int at /srv/gerrit/sanitybot/gerrit-bot.pl line 224. So add and tweak some punctuation to make perl happy again. Thanks to Ossi for the appropriate runes. Change-Id: I211baa2e61cda98fc61ec97775f5a247da00c1f4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
-rwxr-xr-xgit-hooks/gerrit-bot2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-hooks/gerrit-bot b/git-hooks/gerrit-bot
index 29ad4ed..4bd24b7 100755
--- a/git-hooks/gerrit-bot
+++ b/git-hooks/gerrit-bot
@@ -221,7 +221,7 @@ sub process_commit($$$$$)
merge_hashes($verdict, $vd);
}
}
- if ($$verdict{labels}{'Sanity-Review'} == 1 && int($$verdict{comments}) == 0) {
+ if ($$verdict{labels}{'Sanity-Review'} == 1 && int(@{$verdict{comments} || []}) == 0) {
# Don't spam everyone about a boring +1 sanity review with no comments.
$$verdict{notify} = "NONE";
}