Skip to contentSkip to conversation

testinfo.pl: Fix array sort on old perl

PATCH New Petr Vorel 2 participants 3 messages May 13, 2021 – May 14, 2021

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 testinfo.pl: Fix array sort on old perl

From: Petr Vorel <[email protected]>

It fixes failure on perl v5.16.3 (Centos 7):
Can't use an undefined value as an ARRAY reference at docparse/testinfo.pl line 427.

Fixes 824e34034 ("docparse: Sort alphabetically tags in table")
---
 docparse/testinfo.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
docparse/testinfo.pl +1 -1
index 857278ac8..31148e3a4 100755
@@ -424,7 +424,7 @@ sub content_all_tests
 
 		$tmp2 = undef;
 		my %commits;
-		my @sorted_tags = sort { $a->[0] cmp $b->[0] } @{$json->{'tests'}{$name}{tags}};
+		my @sorted_tags = sort { $a->[0] cmp $b->[0] } @{$json->{'tests'}{$name}{tags} // []};
 
 		for my $tag (@sorted_tags) {
 			if (!defined($tmp2)) {
Signature · 1 line
2.31.1
author
#2 lore raw

PATCH 1/1 testinfo.pl: Fix array sort on old perl

Hi Cyril,

Quoted 2 lines

Hi!
Looks good, acked.

Thanks a lot, merged!

Kind regards,
Petr