Skip to content

Commit 3bd056f

Browse files
committed
Bug 1377402 - Add null check in SimpleGlobalObject's class hooks r=sfink
1 parent 2a49ddf commit 3bd056f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dom/bindings/SimpleGlobalObject.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,20 @@ SimpleGlobal_finalize(js::FreeOp *fop, JSObject *obj)
4646
{
4747
SimpleGlobalObject* globalObject =
4848
static_cast<SimpleGlobalObject*>(JS_GetPrivate(obj));
49-
globalObject->ClearWrapper(obj);
50-
NS_RELEASE(globalObject);
49+
if (globalObject) {
50+
globalObject->ClearWrapper(obj);
51+
NS_RELEASE(globalObject);
52+
}
5153
}
5254

5355
static size_t
5456
SimpleGlobal_moved(JSObject *obj, JSObject *old)
5557
{
5658
SimpleGlobalObject* globalObject =
5759
static_cast<SimpleGlobalObject*>(JS_GetPrivate(obj));
58-
globalObject->UpdateWrapper(obj, old);
60+
if (globalObject) {
61+
globalObject->UpdateWrapper(obj, old);
62+
}
5963
return 0;
6064
}
6165

0 commit comments

Comments
 (0)