Fix a null reference exception CID 18098 & 18110