Fix null dereference

Coverity ID 1061551

(cherry picked from commit 9635bc42da3de7616d2ab248694ee9ae7ec2b42e)