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

Commit

Permalink
fix null dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
svenwltr committed Jul 13, 2018
1 parent f666750 commit 0c562ba
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 0c562ba

Please sign in to comment.