Fix NewLocalRef, NewGlobalRef to handle cleared weak globals.

We were not checking for null after decoding the reference, this
meant that we incorrectly created null weak global references instead
of returning null.

Issue: 63929
Bug: 13400455

(cherry-picked from e8c48db6bb507d7fa20c78481c58c23be0045f67)

Change-Id: I9159682e6edad8f415ef8144fc13b9aedd2cceb4
2 files changed