Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #234 from rebuy-de/fix-npe
Browse files Browse the repository at this point in the history
fix null dereference
  • Loading branch information
svenwltr authored Jul 13, 2018
2 parents f666750 + 0c562ba commit db91ad2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/types/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,26 @@ func (p Properties) Set(key string, value interface{}) Properties {

switch v := value.(type) {
case *string:
if v == nil {
return p
}
p[key] = *v
case []byte:
p[key] = string(v)
case *bool:
if v == nil {
return p
}
p[key] = fmt.Sprint(*v)
case *int64:
if v == nil {
return p
}
p[key] = fmt.Sprint(*v)
case *int:
if v == nil {
return p
}
p[key] = fmt.Sprint(*v)
default:
// Fallback to Stringer interface. This produces gibberish on pointers,
Expand Down

0 comments on commit db91ad2

Please sign in to comment.