Skip to content

Commit ca4a22e

Browse files
addaleaxTrott
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: nodejs#25061 (comment) Fixes: nodejs#25134 PR-URL: nodejs#25079 Backport-PR-URL: nodejs#28832 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 4a607fa commit ca4a22e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/uv.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ void Initialize(Local<Object> target,
7171
Local<Array> arr = Array::New(isolate, 2); \
7272
arr->Set(0, OneByteString(isolate, #name)); \
7373
arr->Set(1, OneByteString(isolate, msg)); \
74-
err_map->Set(context, \
75-
Integer::New(isolate, UV_##name), \
76-
arr).ToLocalChecked(); \
74+
if (err_map->Set(context, \
75+
Integer::New(isolate, UV_##name), \
76+
arr).IsEmpty()) { \
77+
return; \
78+
} \
7779
} while (0);
7880
UV_ERRNO_MAP(V)
7981
#undef V

0 commit comments

Comments
 (0)