1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Bounds check x & y.

This commit is contained in:
Rob Rix 2017-03-10 13:13:47 -05:00
parent 91694c4999
commit a15ae4b2e0

View File

@ -115,7 +115,9 @@ decompose myers = let ?callStack = popCallStack callStack in case myers of
maxD = (m + n) `ceilDiv` 2
slide eq (Endpoint x y)
| (as Vector.! x) `eq` (bs Vector.! y) = slide eq (Endpoint (succ x) (succ y))
| x < length as
, y < length bs
, (as Vector.! x) `eq` (bs Vector.! y) = slide eq (Endpoint (succ x) (succ y))
| otherwise = Endpoint x y
FindDPath (EditGraph as bs) Reverse (EditDistance d) (Diagonal k) -> return (Endpoint 0 0)