Fix potential null pointer dereference (found by Coverity).