fix crash when passing null object