Coverity fixes

A few issues identified by coverity.
Can anyone explain to me what is Coverity complaining about in this case? What's wrong with a NULL check?