Explorar o código

Check for defined-ness of value instead of its truthiness

In some cases, the value is 0, like when returning whether or not a
checkbox is selected.
Daniel Gempesaw %!s(int64=11) %!d(string=hai) anos
pai
achega
921cb7be45
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      lib/Selenium/Remote/RemoteConnection.pm

+ 1 - 1
lib/Selenium/Remote/RemoteConnection.pm

@@ -131,7 +131,7 @@ sub _process_response {
         }
         elsif ($response->is_success) {
             $data->{'cmd_status'} = 'OK';
-            if (defined $decoded_json && $decoded_json->{'value'}) {
+            if (defined $decoded_json && defined $decoded_json->{'value'}) {
                 $data->{'cmd_return'} = $decoded_json->{'value'};
             }
             else {