Fixed possible NullPointerException

Fixed possible NullPointerException