Skip to content

Commit 247ae37

Browse files
committed
Fix TruncateEncodings for No Pair Encoding
1 parent 7599e43 commit 247ae37

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

util.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ func TruncateEncodings(encoding, pairEncoding *Encoding, params *TruncationParam
105105
switch params.Strategy {
106106
case LongestFirst:
107107
nFirst := len(encoding.GetIds())
108-
nSecond := len(pairEncoding.GetIds())
108+
nSecond := 0
109+
if pairEncoding != nil {
110+
nSecond = len(pairEncoding.GetIds())
111+
}
109112

110113
for i := 0; i < toRemove; i++ {
111114
if nFirst > nSecond {

0 commit comments

Comments
 (0)