Skip to content

Commit 94a8e43

Browse files
committed
chore: towards warning-free building for JS::RootedVector::append
See also commit 546d0ce
1 parent 2e65cf1 commit 94a8e43

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/internalBinding/timers.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "include/pyTypeFactory.hh"
1111
#include "include/jsTypeFactory.hh"
1212
#include "include/PyEventLoop.hh"
13+
#include "include/setSpiderMonkeyException.hh"
1314

1415
#include <jsapi.h>
1516
#include <js/Array.h>
@@ -121,7 +122,11 @@ static bool getAllRefedTimersDebugInfo(JSContext *cx, unsigned argc, JS::Value *
121122
JS::RootedVector<JS::Value> results(cx);
122123
for (AsyncHandle &timer: AsyncHandle::getAllRefed()) {
123124
JS::Value debugInfo = jsTypeFactory(cx, timer.getDebugInfo());
124-
results.append(debugInfo);
125+
if (!results.append(debugInfo)) {
126+
// out of memory
127+
setSpiderMonkeyException(cx);
128+
return false;
129+
}
125130
}
126131

127132
args.rval().setObjectOrNull(JS::NewArrayObject(cx, results));

0 commit comments

Comments
 (0)