Skip to content

Commit

Permalink
fix: handle nil value first, to prevent nuptrexp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamidreza Kalantari committed Jan 31, 2021
1 parent ab0fa2e commit ce751b3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package logrus_sentry
import (
"encoding/json"
"fmt"
"reflect"
"runtime"
"sync"
"time"
Expand Down Expand Up @@ -393,6 +394,10 @@ func (hook *SentryHook) formatExtraData(df *dataField) (result map[string]interf

// formatData returns value as a suitable format.
func formatData(value interface{}) (formatted interface{}) {
if value == nil {
return "nil " + reflect.TypeOf(value).String()
}

switch value := value.(type) {
case json.Marshaler:
return value
Expand Down

0 comments on commit ce751b3

Please sign in to comment.