diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-07-08 06:53:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-08 06:53:33 +0200 |
commit | 9bbd8d368598046c47964ee043620621b6c3634b (patch) | |
tree | f5c658f48c37a9e1ec315d782e90b50f577ba100 | |
parent | e8f272c6f79dc8a919911d88a5b455bc67792f64 (diff) | |
download | bugzilla-9bbd8d368598046c47964ee043620621b6c3634b.tar.gz bugzilla-9bbd8d368598046c47964ee043620621b6c3634b.tar.xz |
fix bug in flagtype comments when there are no flag types
-rw-r--r-- | extensions/FlagTypeComment/Extension.pm | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/extensions/FlagTypeComment/Extension.pm b/extensions/FlagTypeComment/Extension.pm index 3ec506176..e7b34113d 100644 --- a/extensions/FlagTypeComment/Extension.pm +++ b/extensions/FlagTypeComment/Extension.pm @@ -127,13 +127,18 @@ sub _set_ftc_states { 'active_or_has_flags' => $bug->id, }); - my $types = join(',', map { $_->id } @$flag_types); - my $states = "'" . join("','", FLAGTYPE_COMMENT_STATES) . "'"; - $db_result = $dbh->selectall_arrayref( - "SELECT type_id AS flagtype, on_status AS state, comment AS text - FROM flagtype_comments - WHERE type_id IN ($types) AND on_status IN ($states)", - { Slice => {} }); + if (@$flag_types) { + my $types = join(',', map { $_->id } @$flag_types); + my $states = "'" . join("','", FLAGTYPE_COMMENT_STATES) . "'"; + $db_result = $dbh->selectall_arrayref( + "SELECT type_id AS flagtype, on_status AS state, comment AS text + FROM flagtype_comments + WHERE type_id IN ($types) AND on_status IN ($states)", + { Slice => {} }); + } + else { + $db_result = []; + } } foreach my $row (@$db_result) { |