Fixed bug NMS-5134 by adding null check.