Skip to content

Commit

Permalink
Default content to an empty arrayref rather than undef
Browse files Browse the repository at this point in the history
If $content is undef because Elements had no value, the
JSON::to_json comparison with $new_content can fail with:

    hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this)

We have seen this error when the JSON module is running with
JSON::PP rather than JSON::XS.
  • Loading branch information
cbrandtbuffalo committed Oct 9, 2024
1 parent e2ded3f commit 35eee5b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion share/html/Dashboards/Queries.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
} else {
$title = loc("Modify the content of dashboard [_1]", $Dashboard->Name);
}
my $content = $Dashboard->{Attribute}->SubValue('Elements');
my $content = $Dashboard->{Attribute}->SubValue('Elements') || [];

if ( $ARGS{AddRow} || $ARGS{Update} ) {

Expand Down

0 comments on commit 35eee5b

Please sign in to comment.