Skip to content
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

NPE introduced by v0.4.5 #64

Open
sysradium opened this issue Oct 22, 2018 · 0 comments
Open

NPE introduced by v0.4.5 #64

sysradium opened this issue Oct 22, 2018 · 0 comments

Comments

@sysradium
Copy link

sysradium commented Oct 22, 2018

In here:
57846a8#diff-0b771ec7e8ca759d819dc583bbdc795aR212

We are relying on a fact, that the stacktrace is not nil, however here:

57846a8#diff-0b771ec7e8ca759d819dc583bbdc795aR204

We can still get nil. And sometimes raven.NewStacktrace(...) returns nil, causing all of that panic:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x985fc6]

goroutine 984 [running]:
github.com/.../vendor/github.com/getsentry/raven-go.(*Stacktrace).Culprit(0x0, 0x0, 0x0)
        /go/src/github.com/.../vendor/github.com/getsentry/raven-go/stacktrace.go:29 +0x26
github.com/.../vendor/github.com/evalphobia/logrus_sentry.(*SentryHook).Fire(0xc420129760, 0xc4214007d0, 0x0, 0x0)

So probably a nil check has to be added, like:

if stConfig.SwitchExceptionTypeAndMessage {
	exc.Type, exc.Value = exc.Value, exc.Type
	packet.Interfaces = append(packet.Interfaces, currentStacktrace)
        if currentStacktrace != nil {
	      packet.Culprit = exc.Type + ": " + currentStacktrace.Culprit()
        }
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant