avoid potential null ptr deref (Coverity)