Also avoid undefined value errors if the locale value is missing.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/SetWinLocale | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale index 947c1e0d1..d9a9e0340 100755 --- a/testbot/bin/SetWinLocale +++ b/testbot/bin/SetWinLocale @@ -279,14 +279,16 @@ sub CheckValue($$) sub CheckLocale($$) { my ($Option, $Value) = @_; + $Value = CheckValue($Option, $Value); - if ($Value !~ /^(?:[a-z]{2})-(?:Latn-)?(?:[A-Z]{2})$/) - { - Error("'$Value' is not a valid $Option locale\n"); - $Usage = 2; - return undef; - } - return $Value; + return undef if (!defined $Value); + + $Value =~ s/_/-/g; + return $Value if ($Value =~ /^(?:[a-z]{2})-(?:Latn-)?(?:[A-Z]{2})$/); + + Error("'$Value' is not a valid $Option locale\n"); + $Usage = 2; + return undef; }
my ($OptHostName, $OptReboot);