check if pointer null before doing anything on it :-)