git cherry-pick: do not dereference a potential NULL pointer