From 6fe691fb3cccb9dc294c3be945f394d4e1cb5946 Mon Sep 17 00:00:00 2001 From: IvanWang Date: Tue, 14 Sep 2021 15:46:16 +0800 Subject: [PATCH] fix issue 272 --- lib/core/segments.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/segments.js b/lib/core/segments.js index ba8be178..43dbfd2b 100644 --- a/lib/core/segments.js +++ b/lib/core/segments.js @@ -202,12 +202,12 @@ function buildGraph (nodes, version) { getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode) - table[prevNodeId].lastCount += node.length + table[key].lastCount += node.length } else { - if (table[prevNodeId]) table[prevNodeId].lastCount = node.length - graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version) // switch cost + + table[key].lastCount = node.length } } }