Add nullptr checks

This code is never actually called with NULL pointers, but since we were
already checking for NULL, might as well do it everywhere.

Bug: 111882151
Test: build
Change-Id: Ia121a74c010262ac6023030e5d0fc04deb07e047
1 file changed