Add code for handling NULL exception