From 473b85cffa27e171efed7c9d1eaaa06fcec274ae Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Fri, 14 Jul 2017 18:26:06 +0800 Subject: [PATCH] fix nil pointer issue --- src/ui/api/systeminfo.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/api/systeminfo.go b/src/ui/api/systeminfo.go index eadc7ed87..d1feaf1c2 100644 --- a/src/ui/api/systeminfo.go +++ b/src/ui/api/systeminfo.go @@ -51,12 +51,12 @@ type Storage struct { //namespaces stores all name spaces on Clair, it should be initialised only once. type clairNamespaces struct { - *sync.RWMutex + sync.RWMutex l []string clair *clair.Client } -func (n clairNamespaces) get() ([]string, error) { +func (n *clairNamespaces) get() ([]string, error) { n.Lock() defer n.Unlock() if len(n.l) == 0 { @@ -80,7 +80,7 @@ func (n clairNamespaces) get() ([]string, error) { } var ( - namespaces clairNamespaces + namespaces = &clairNamespaces{} ) //GeneralInfo wraps common systeminfo for anonymous request