Fix NULL pointer dereferences
Fix NULL pointer dereferences identified as V522 by PVS-Studio.
MFC after: 1 week Sponsored by: Multiplay