Skip to content

Search backend: fix issues with null and zero-length offsetAndLength

Warren Gifford requested to merge cc/fix-to-line-matches into main

Created by: camdencheek

The code that converts ChunkMatch into []LineMatch treats zero-length matches as valid, which they are. However, it's not expected that a LineMatch has zero-length or nil offsetAndLengths. To maintain backwards compatibility, I've udpated the conversion function to stop generating line matches like this.

Test plan

Added a test case for this. Also tested manually that it fixed the browser crash from null offsetAndLength.

Proof that it fixes the issue: Screen Shot 2022-06-03 at 15 28 03

Merge request reports

Loading