Skip to content

Commit fb37995

Browse files
committed
避免不必要的panic
1 parent 0ead695 commit fb37995

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libs/levelredis/level_list.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"GoRedis/libs/gorocks"
88
"bytes"
99
"errors"
10+
"os"
1011
"strconv"
1112
"strings"
1213
"sync"
@@ -51,7 +52,8 @@ func (l *LevelList) initCount() {
5152
l.start, _ = strconv.ParseInt(pairs[0], 10, 64)
5253
l.end, _ = strconv.ParseInt(pairs[1], 10, 64)
5354
if !(l.end == -1 && l.start == 0) && l.end < l.start {
54-
panic("bad list: " + l.entryKey)
55+
os.Stderr.WriteString("bad list: " + l.entryKey)
56+
l.start, l.end = 0, -1
5557
}
5658
}
5759

0 commit comments

Comments
 (0)