Fix coverity issue 10359, possible dereference of null pointer.  #3496