LPS-47559 Added missing check to avoid NullPointerException