Fix a few static analyzer concerns about dereferencing null value. Differential Revision: https://reviews.llvm.org/D158671