Bug 727987 - Add null check to Boolean conversion (r=Waldo)
authorBill McCloskey <wmccloskey@mozilla.com>
Thu, 23 Feb 2012 14:34:12 -0800
changeset 87584 24dd2472229fb4abbb516b3887de55ca58913b03
parent 87583 168d1528a2da87f9cfd4c7e2760dee40975a75e1
child 87585 f00bab9999f9640ffc82221d901d1b23d8991982
push id22133
push usermak77@bonardo.net
push dateFri, 24 Feb 2012 10:23:30 +0000
treeherdermozilla-central@fbcdc2c87df8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs727987
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 727987 - Add null check to Boolean conversion (r=Waldo)
js/src/jsbool.cpp
--- a/js/src/jsbool.cpp
+++ b/js/src/jsbool.cpp
@@ -137,16 +137,18 @@ static JSBool
 Boolean(JSContext *cx, uintN argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     bool b = args.length() != 0 ? js_ValueToBoolean(args[0]) : false;
 
     if (IsConstructing(vp)) {
         JSObject *obj = BooleanObject::create(cx, b);
+        if (!obj)
+            return false;
         args.rval().setObject(*obj);
     } else {
         args.rval().setBoolean(b);
     }
     return true;
 }
 
 JSObject *