소스 검색

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]
 	}