Skip to content

fixed 'bad access: nil dereference' when calling Error() method if it… - #577

Open
henng wants to merge 2 commits into
pingcap:masterfrom
henng:master
Open

fixed 'bad access: nil dereference' when calling Error() method if it…#577
henng wants to merge 2 commits into
pingcap:masterfrom
henng:master

Conversation

@henng

Copy link
Copy Markdown

SEE #576

@codecov

codecovBot commented Oct 12, 2019

Copy link
Copy Markdown

Codecov Report

Merging #577 into master will decrease coverage by 0.01%.
The diff coverage is 50%.

Impacted file tree graph

@@ 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
Impacted FilesCoverage Δ
terror/terror.go73.43% <50%> (-0.76%)⬇️
ast/functions.go76.74% <0%> (ø)⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbfc40a...4a34588. Read the comment docs.

@zz-jason
zz-jason requested a review from a teamOctober 16, 2019 12:58
Comment threadterror/terror.go

// Error implements error interface.
func (e *Error) Error() string {
if reflect2.IsNil(e) {

Copy link
Copy Markdown
Contributor

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{}.

Copy link
Copy Markdown
Author

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.

Comment threadterror/terror.go
}

func (e *Error) getMsg() string {
if reflect2.IsNil(e) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ditto)

@jyno12

jyno12 commented Mar 19, 2021

Copy link
Copy Markdown

这个现在有啥别的修改?model/ddl中的job也遇到这个问题。

import (
"github.com/pingcap/parser/model"
"testing"
)
func TestJob(t *testing.T) {
j:=model.Job{}
t.Logf("%v",j)
}

由于job中的error为nil也是这个问题。

@tiancaiamao

Copy link
Copy Markdown
Collaborator

Ping @henng ?

@ti-chi-bot

Copy link
Copy Markdown
Member

@henng: PR needs rebase.

Details

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.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.81%. Comparing base (aa72817) to head (081dece).
⚠️ Report is 421 commits behind head on master.

⚠️Current head 081dece differs from pull request most recent head 4a34588

Please upload reports for the commit 4a34588 to get more accurate results.

Additional details and impacted files
@@ 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 
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@henng@jyno12@tiancaiamao@ti-chi-bot@codecov-commenter@kennytm@zz-jason