-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed 'bad access: nil dereference' when calling Error() method if it… #577
base: master
Are you sure you want to change the base?
Conversation
…self is a nil reference.
Codecov Report
@@ Coverage Diff @@
## master #577 +/- ##
==========================================
- Coverage 71.82% 71.81% -0.02%
==========================================
Files 32 32
Lines 7834 7838 +4
==========================================
+ Hits 5627 5629 +2
- Misses 1676 1677 +1
- Partials 531 532 +1
Continue to review full report at Codecov.
|
@@ -213,10 +214,16 @@ func (e *Error) Location() (file string, line int) { | |||
|
|||
// Error implements error interface. | |||
func (e *Error) Error() string { | |||
if reflect2.IsNil(e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why e == nil
is not enough? *Error
is a concrete type unlike interface{}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, e == nil
is better.
return fmt.Sprintf("[%s:%d]%s", e.class, e.code, e.getMsg()) | ||
} | ||
|
||
func (e *Error) getMsg() string { | ||
if reflect2.IsNil(e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(ditto)
这个现在有啥别的修改?model/ddl中的job也遇到这个问题。
由于job中的error为nil也是这个问题。 |
Ping @henng ? |
@henng: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
SEE #576