Fix NULL dereference, found by Coverity CID 1202409