added null pointer check, as Surcharge might be null

tested on dev api, the lib would crash if there's no null check.