avoid throwing null-ptr error, log it instead