IDEX-479: Added checking for NPE