[tools] testbot/cgi: Fix handling of '0' in text fields.

Francois Gouget fgouget at codeweavers.com
Tue Mar 29 10:57:39 CDT 2022


'0' should be set as the field's initial value even though it evaluates
to false.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/ObjectModel/CGI/FormPage.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm
index 0f4c5cd0e..b85ccb297 100644
--- a/testbot/lib/ObjectModel/CGI/FormPage.pm
+++ b/testbot/lib/ObjectModel/CGI/FormPage.pm
@@ -300,7 +300,7 @@ sub GenerateField($$$)
         print "50' rows='", int(($MaxLength + 49) / 50);
       }
       print "'>";
-      if ($Value)
+      if (defined $Value)
       {
         print $self->CGI->escapeHTML($Value), "'";
       }
@@ -313,7 +313,7 @@ sub GenerateField($$$)
       $Size=45 if ($Size > 45);
       print "<input type='$InputType' name='", $PropertyDescriptor->GetName(),
             "' maxlength='", $PropertyDescriptor->GetMaxLength(), "' size='$Size'";
-      if ($Value && $InputType ne "password")
+      if (defined $Value && $InputType ne "password")
       {
         print " value='", $self->CGI->escapeHTML($Value), "'";
       }
-- 
2.30.2



More information about the wine-devel mailing list