Skip to content

Commit 496d8f6

Browse files
author
Andrew Ruthven
committed
many_to_many relationships sometimes didn't work with lookup_options
It looks like sometimes $new_result can return false. Use defined instead so we always know if there is an object present.
1 parent 1d90c25 commit 496d8f6

File tree

1 file changed

+1
-1
lines changed
  • lib/HTML/FormHandler/TraitFor/Model

1 file changed

+1
-1
lines changed

lib/HTML/FormHandler/TraitFor/Model/DBIC.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ sub lookup_options {
365365
# check for many_to_many multiple select
366366
my $resultset = $self_source->resultset;
367367
my $new_result = $resultset->new_result( {} );
368-
if ( $new_result && $new_result->can("add_to_$accessor") ) {
368+
if ( defined $new_result && $new_result->can("add_to_$accessor") ) {
369369
$source = $new_result->$accessor->result_source;
370370
}
371371
}

0 commit comments

Comments
 (0)