Fix for setting error object when the error pointer is nil.