diff --git a/js/src/vm/SavedStacks.cpp b/js/src/vm/SavedStacks.cpp index 6daedc7e59b2..0d8c736c99c1 100644 --- a/js/src/vm/SavedStacks.cpp +++ b/js/src/vm/SavedStacks.cpp @@ -392,12 +392,16 @@ SavedFrame::toStringMethod(JSContext *cx, unsigned argc, Value *vp) || !NumberValueToStringBuffer(cx, NumberValue(frame->getLine()), sb) || !sb.append(':') || !NumberValueToStringBuffer(cx, NumberValue(frame->getColumn()), sb) - || !sb.append('\n')) { + || !sb.append('\n')) + { return false; } } while ((frame = frame->getParent())); - args.rval().setString(sb.finishString()); + JSString *str = sb.finishString(); + if (!str) + return false; + args.rval().setString(str); return true; }