Catching possible nullpointer exception.