Browse Source

LibJS: Return empty value on exception in Date.parse(), not NaN

This is discarded anyway, so let's not confuse ourselves by returning a
NaN number value that's not going to be used.
Linus Groh 4 năm trước cách đây
mục cha
commit
2ed7f75e95
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      Userland/Libraries/LibJS/Runtime/DateConstructor.cpp

+ 1 - 1
Userland/Libraries/LibJS/Runtime/DateConstructor.cpp

@@ -229,7 +229,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateConstructor::parse)
 
     auto iso_8601 = vm.argument(0).to_string(global_object);
     if (vm.exception())
-        return js_nan();
+        return {};
 
     return parse_simplified_iso8601(iso_8601);
 }