Skip to content

Commit

Permalink
fix: panic when reload
Browse files Browse the repository at this point in the history
  • Loading branch information
mzz2017 committed Aug 23, 2021
1 parent 7747782 commit 51a94d2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions config/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

type Upstream interface {
GetName() string
GetName() string
GetServers() (servers []Server, err error)
}

Expand All @@ -27,7 +27,9 @@ func Map2Upstream(m UpstreamConf, upstream interface{}) error {
tag := f.Tag
key := tag.Get("json")
vf := v.Field(i)
vf.SetString(m[key].(string))
if v, ok := m[key].(string); ok {
vf.SetString(v)
}
}
return nil
}

0 comments on commit 51a94d2

Please sign in to comment.