mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Fail if JS_NewUCStringCopyN returns null in str_to_jsval.
This commit is contained in:
parent
d9cf8cc4cc
commit
23d9a5af4b
1 changed files with 2 additions and 4 deletions
|
@ -211,11 +211,9 @@ pub unsafe fn str_to_jsval(cx: *JSContext, string: DOMString) -> JSVal {
|
|||
let string_utf16 = string.to_utf16();
|
||||
let jsstr = JS_NewUCStringCopyN(cx, string_utf16.as_ptr(), string_utf16.len() as libc::size_t);
|
||||
if jsstr.is_null() {
|
||||
// FIXME: is there something else we should do on failure?
|
||||
JSVAL_NULL
|
||||
} else {
|
||||
RUST_STRING_TO_JSVAL(jsstr)
|
||||
fail!("JS_NewUCStringCopyN failed");
|
||||
}
|
||||
RUST_STRING_TO_JSVAL(jsstr)
|
||||
}
|
||||
|
||||
pub unsafe fn domstring_to_jsval(cx: *JSContext, string: Option<DOMString>) -> JSVal {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue