Protection against dereferencing null pointer