made sure we don't dereference a nil pointer (when no error is passed in)