瀏覽代碼

A bit of safety

Loweel 4 年之前
父節點
當前提交
d70f792edc
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      matrix.go

+ 1 - 1
matrix.go

@@ -197,7 +197,7 @@ func sortMap(unsorted *sync.Map, size int) {
 
 	sort.Slice(tempCont, func(i, j int) bool { return tempCont[i].Num > tempCont[j].Num })
 
-	if len(tempCont) > size && size > 0 {
+	if size > 0 && len(tempCont) > size {
 		tempCont = tempCont[:size]
 	}