[PATCH 6/6] Avoid potentially dereferencing a NULL pointer