Add code to check null parameter and throw exception