Skip to content

src: no abort from GetFD if object isn't wrapped

Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • the commit message follows commit guidelines
Affected core subsystem(s)

stream_base, base_object

Description of change

Previously the 0-index slot from v8::Object::GetAlignedPointerFromInternalField() would return random data if Wrap() hadn't been run on the object handle. Now immediately set the slot to nullptr so we can know for sure whether it's been set or not. Use this information to return -1 from GetFD() instead of aborting.

R=@bnoordhuis R=@indutny

CI: https://ci.nodejs.org/job/node-test-pull-request/2254/

Merge request reports

Loading