Fix for possible null pointer dereferencing, closes Coverity report 68 run 2.