Przeglądaj źródła

:art: Brand new marketplace UI https://github.com/siyuan-note/siyuan/issues/8181

Liang Ding 2 lat temu
rodzic
commit
a219cf52f5
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      kernel/bazaar/package.go

+ 2 - 2
kernel/bazaar/package.go

@@ -262,7 +262,7 @@ func ThemeJSON(themeDirName string) (ret *Theme, err error) {
 	return
 	return
 }
 }
 
 
-var cachedStageIndex map[string]*StageIndex
+var cachedStageIndex = map[string]*StageIndex{}
 var stageIndexCacheTime int64
 var stageIndexCacheTime int64
 var stageIndexLock = sync.Mutex{}
 var stageIndexLock = sync.Mutex{}
 
 
@@ -276,7 +276,7 @@ func getStageIndex(pkgType string) (ret *StageIndex, err error) {
 	defer stageIndexLock.Unlock()
 	defer stageIndexLock.Unlock()
 
 
 	now := time.Now().Unix()
 	now := time.Now().Unix()
-	if 3600 >= now-stageIndexCacheTime {
+	if 3600 >= now-stageIndexCacheTime && nil != cachedStageIndex[pkgType] {
 		ret = cachedStageIndex[pkgType]
 		ret = cachedStageIndex[pkgType]
 		return
 		return
 	}
 	}