From 849e1858d699012cffa42912b7db75b23077db69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Mon, 5 Jun 2017 00:40:23 +0200 Subject: Make sure $args->{changes} exists to not autovivify it when no changes are made --- extensions/Mageia/Extension.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'extensions') diff --git a/extensions/Mageia/Extension.pm b/extensions/Mageia/Extension.pm index 819838b95..60ca57f00 100644 --- a/extensions/Mageia/Extension.pm +++ b/extensions/Mageia/Extension.pm @@ -49,10 +49,15 @@ sub bug_end_of_update { my $dbh = Bugzilla->dbh; my $user = Bugzilla->user; - # If a user enters 'validated_update' as keyword, - # automatically CC sysadmin-bugs@ml.mageia.org. - my $new_keywords_str = $args->{changes}->{keywords}->[1]; + my $new_keywords_str; + # Call exists to avoid autovivification of $args->{changes} if it does not exist. + # Else $bug->update() always sees the bug as being edited. + if (exists $args->{changes} && exists $args->{changes}->{keywords}) { + $new_keywords_str = $args->{changes}->{keywords}->[1]; + } + # If a user enters 'validated_update' as keyword, automatically + # CC sysadmin-bugs@ml.mageia.org. if ($new_keywords_str) { my @new_keywords = split(/[,\s]+/, $new_keywords_str); if (grep { $_ eq 'validated_update' } @new_keywords -- cgit v1.2.1