[#1404] added check for null
[#1404] added a null check