Protect against NULL pointer dereference