From 67f95825e5ad3f80d007613df8b21f4f2819c635 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 17 Dec 2018 02:22:35 +0100 Subject: 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: https://github.com/nodejs/node/pull/25061#issuecomment-447648475 Fixes: https://github.com/nodejs/node/issues/25134 PR-URL: https://github.com/nodejs/node/pull/25079 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig --- src/uv.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/uv.cc') diff --git a/src/uv.cc b/src/uv.cc index 79c221f4df..27daed556e 100644 --- a/src/uv.cc +++ b/src/uv.cc @@ -81,9 +81,11 @@ void Initialize(Local target, OneByteString(isolate, #name), \ OneByteString(isolate, msg) \ }; \ - err_map->Set(context, \ - Integer::New(isolate, UV_##name), \ - Array::New(isolate, arr, arraysize(arr))).ToLocalChecked(); \ + if (err_map->Set(context, \ + Integer::New(isolate, UV_##name), \ + Array::New(isolate, arr, arraysize(arr))).IsEmpty()) { \ + return; \ + } \ } while (0); UV_ERRNO_MAP(V) #undef V -- cgit v1.2.3