Browse Source

A bit of safety

Loweel 4 years ago
parent
commit
d70f792edc
1 changed files with 1 additions and 1 deletions
  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]
 	}