src: fix null deref in AllocatedBuffer::clear
An empty buffer can have a null environment. Previously, we were getting away with with this, but -fsanitize=null in clang caught it.
Cherry-pick of https://github.com/nodejs/node/pull/32892 to v12.x branch.
Ref: https://github.com/nodejs/node/pull/32892
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows [commit guidelines]