Module: tools
Branch: master
Commit: f6720d15fec1fe6d565241a03e607be089854a6b
URL: https://source.winehq.org/git/tools.git/?a=commit;h=f6720d15fec1fe6d565241a…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Fri Mar 30 12:11:51 2018 +0200
testbot: Fix Collection::IsEmpty() on perl 5.20.
Although scalar(%hash) is 0 when the hash is empty, the rest of the time
it is not a number.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/ObjectModel/Collection.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm
index a57a329..032c738 100644
--- a/testbot/lib/ObjectModel/Collection.pm
+++ b/testbot/lib/ObjectModel/Collection.pm
@@ -420,8 +420,9 @@ sub IsEmpty($)
}
# Even though scalar(hash) does not return the number of items in Perl 5.20
- # it returns 0 for an empty hash.
- return !$self->{Items} || scalar(%{$self->{Items}}) == 0;
+ # (and cannot generally be compared to numbers), it evaluates to true for
+ # all hashes except empty ones.
+ return !$self->{Items} || !%{$self->{Items}};
}
sub CombineKey($@)