Added try catch block for null pointer