Prevent null_ptr crashes.