Skip to content

Commit 272a03a

Browse files
sigmundchcommit-bot@chromium.org
authored andcommitted
[ddc,dart2js] restore null check in dart:js
Change-Id: I275c202368eabc3d72fb49ff21d8635e0905ad69 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135443 Reviewed-by: Vijay Menon <vsm@google.com> Commit-Queue: Sigmund Cherem <sigmund@google.com>
1 parent 0fa3d79 commit 272a03a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

sdk_nnbd/lib/_internal/js_dev_runtime/patch/js_patch.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class JsObject {
3838

3939
@patch
4040
factory JsObject.fromBrowserObject(Object object) {
41-
if (object is num || object is String || object is bool) {
42-
throw ArgumentError("object cannot be a num, string, or bool");
41+
if (object is num || object is String || object is bool || object == null) {
42+
throw ArgumentError("object cannot be a num, string, bool, or null");
4343
}
4444
return _wrapToDart(_convertToJS(object)!);
4545
}

sdk_nnbd/lib/_internal/js_runtime/lib/js_patch.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ class JsObject {
115115

116116
@patch
117117
factory JsObject.fromBrowserObject(Object object) {
118-
if (object is num || object is String || object is bool) {
119-
throw ArgumentError("object cannot be a num, string, or bool");
118+
if (object is num || object is String || object is bool || object == null) {
119+
throw ArgumentError("object cannot be a num, string, bool, or null");
120120
}
121121
return _wrapToDart(_convertToJS(object));
122122
}

0 commit comments

Comments
 (0)