fixed mistake. Error handling in case obj is nil

@michaelarmstrong I've fixed mistake: if obj is nil, method will quit silently, without returning an error.