8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1823562 commit 3805c67Copy full SHA for 3805c67
mozjs/src/error.rs
@@ -52,7 +52,9 @@ unsafe extern "C" fn get_error_message(
52
/// passed back to the get_error_message callback.
53
/// c_uint is u32, so this cast is safe, as is casting to/from i32 from there.
54
unsafe fn throw_js_error(cx: *mut JSContext, error: &str, error_number: u32) {
55
- let error = CString::new(error).unwrap();
+ let error = CString::new(error)
56
+ .or_else(|_| CString::new(error.replace("\0", "\\u0000")))
57
+ .unwrap();
58
JS_ReportErrorNumberUTF8(
59
cx,
60
Some(get_error_message),
0 commit comments