[napi] properly initialize and check status (#12279)#12283
[napi] properly initialize and check status (#12279)#12283gabrielschulhof wants to merge 1 commit intonodejs:masterfrom
Conversation
Initialize status to napi_generic_failure and only check it after having made an actual N-API call. This fixes up 8fbace1.
|
A nit concerning commit messge (see guideline). It could be replaced by something like this (but it can be done by someone who will land this PR): |
|
|
|
I think it could be considered green, but just in case: |
| if (env->has_instance_available) { | ||
| napi_value value, js_result, has_instance = nullptr; | ||
| napi_status status; | ||
| napi_status status = napi_generic_failure; |
There was a problem hiding this comment.
Because then everything will come tumbling down if you compare the value without setting it first - on every platform, all the time.
There was a problem hiding this comment.
I mean why not napi_ok (which is 0)?
|
|
|
@refack Sorry, wrong hash in "Landed in...". And it is better to use full URL in |
|
Actually landed in afd5966 |
|
Thanks for the quick fix/review/land, @gabrielschulhof @refack & @vsemozhetbyt! Still a bunch of infrastructure-related stuff going wrong on CI, but hopefully we get this all straightened out soon. Definitely highlights the room for improvement in our process, for sure. |
|
Thanks, and sorry about the fuss! |
|
💩 happens... |
|
nod |
Initialize status to napi_generic_failure and only check it after having made an actual N-API call. This fixes up 8fbace1. PR-URL: nodejs#12283 Ref: nodejs#12279 Reviewed-By: Refael Ackermann <refack@gmail.com>
Initialize status to napi_generic_failure and only check it after
having made an actual N-API call.
This fixes up 8fbace1.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
n-api