Fix crash: add check for pointer validity
Fix crash: add check for pointer validity

BUG:302343

sandsmark/kate,DickJ/kate,hlamer/kate,DickJ/kate,sandsmark/kate,DickJ/kate,hlamer/kate,jfmcarreira/kate,hlamer/kate,hlamer/kate,cmacq2/kate,hlamer/kate,jfmcarreira/kate,hlamer/kate,cmacq2/kate,hlamer/kate,DickJ/kate,hlamer/kate,hlamer/kate,sandsmark/kate,jfmcarreira/kate,cmacq2/kate,hlamer/kate,sandsmark/kate