Merge pull request #2789 from reasonerjt/master

fix nil pointer issue
This commit is contained in:
Daniel Jiang 2017-07-14 20:37:00 +08:00 committed by GitHub
commit 6f2ff672c4

View File

@ -51,12 +51,12 @@ type Storage struct {
//namespaces stores all name spaces on Clair, it should be initialised only once. //namespaces stores all name spaces on Clair, it should be initialised only once.
type clairNamespaces struct { type clairNamespaces struct {
*sync.RWMutex sync.RWMutex
l []string l []string
clair *clair.Client clair *clair.Client
} }
func (n clairNamespaces) get() ([]string, error) { func (n *clairNamespaces) get() ([]string, error) {
n.Lock() n.Lock()
defer n.Unlock() defer n.Unlock()
if len(n.l) == 0 { if len(n.l) == 0 {
@ -80,7 +80,7 @@ func (n clairNamespaces) get() ([]string, error) {
} }
var ( var (
namespaces clairNamespaces namespaces = &clairNamespaces{}
) )
//GeneralInfo wraps common systeminfo for anonymous request //GeneralInfo wraps common systeminfo for anonymous request