Skip to content

Commit

Permalink
Avoid warning about use of uninitialized value
Browse files Browse the repository at this point in the history
The variable `$testsuite_name` might be `undef` if the spec is an empty
hash leading to:

```
Use of uninitialized value $testsuite_name in hash element at /usr/share/openqa/script/../lib/OpenQA/Schema/Result/JobGroups.pm line 413.
```

We can just skip empty specs here avoiding the warning.
  • Loading branch information
Martchus committed Mar 21, 2024
1 parent e985d28 commit 3a4a737
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/OpenQA/Schema/Result/JobGroups.pm
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ sub _parse_job_template_products ($yaml_products_for_arch, $yaml_defaults_for_ar
my $description = '';
if (ref $spec eq 'HASH') {
# We only have one key. Asserted by schema
$testsuite_name = (keys %$spec)[0];
next unless $testsuite_name = (keys %$spec)[0];
my $attr = $spec->{$testsuite_name};
if ($attr->{priority}) {
$prio = $attr->{priority};
Expand Down

0 comments on commit 3a4a737

Please sign in to comment.