Skip to content

Commit c6388ed

Browse files
addaleaxMylesBorins
authored andcommitted
src: handle empty Maybe in uv binding initialize
This can fail when terminating a Worker that loads the `uv` binding at the same time. Refs: #25061 (comment) Fixes: #25134 PR-URL: #25079 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent d1a98a8 commit c6388ed

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/uv.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ void Initialize(Local<Object> target,
8181
OneByteString(isolate, #name), \
8282
OneByteString(isolate, msg) \
8383
}; \
84-
err_map->Set(context, \
85-
Integer::New(isolate, UV_##name), \
86-
Array::New(isolate, arr, arraysize(arr))).ToLocalChecked(); \
84+
if (err_map->Set(context, \
85+
Integer::New(isolate, UV_##name), \
86+
Array::New(isolate, arr, arraysize(arr))).IsEmpty()) { \
87+
return; \
88+
} \
8789
} while (0);
8890
UV_ERRNO_MAP(V)
8991
#undef V

0 commit comments

Comments
 (0)