diff options
author | Josh Matthews <josh@joshmatthews.net> | 2024-08-16 12:49:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-16 16:49:56 +0000 |
commit | 3829e91662c2f139d9514aa1b5ede4462000f43a (patch) | |
tree | 14d9c43faa2e250bc3566c87709903f0a1f63ce7 /components/script/dom/console.rs | |
parent | 4df7a1af25b46146fc5a580ad2e50f2ebe91e154 (diff) | |
download | servo-3829e91662c2f139d9514aa1b5ede4462000f43a.tar.gz servo-3829e91662c2f139d9514aa1b5ede4462000f43a.zip |
Handle failed string conversions in console.log. (#33085)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/dom/console.rs')
-rw-r--r-- | components/script/dom/console.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs index f1e21b5897b..ae041dfa7da 100644 --- a/components/script/dom/console.rs +++ b/components/script/dom/console.rs @@ -73,6 +73,9 @@ where unsafe fn handle_value_to_string(cx: *mut jsapi::JSContext, value: HandleValue) -> DOMString { rooted!(in(cx) let mut js_string = std::ptr::null_mut::<jsapi::JSString>()); js_string.set(JS_ValueToSource(cx, value)); + if js_string.is_null() { + return "<error converting value to string>".into(); + } jsstring_to_str(cx, *js_string) } |