mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
jsstring_to_str should accept a NonNull argument for the JS string (#33306)
Instead of asserting the raw pointer is not null, force callers to produce a NonNull pointer. Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
This commit is contained in:
parent
642c25d9a7
commit
aadc212b95
6 changed files with 40 additions and 38 deletions
|
@ -259,7 +259,7 @@ unsafe fn id_to_source(cx: SafeJSContext, id: RawHandleId) -> Option<DOMString>
|
|||
jsstr.set(jsapi::JS_ValueToSource(*cx, value.handle().into()));
|
||||
jsstr.get()
|
||||
})
|
||||
.filter(|jsstr| !jsstr.is_null())
|
||||
.and_then(|jsstr| ptr::NonNull::new(jsstr))
|
||||
.map(|jsstr| jsstring_to_str(*cx, jsstr))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue