check if pointer is != NULL before dereferencing it (Coverity CID 40)