diff --git a/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.Lib/Day10.fs b/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.Lib/Day10.fs index 9e3115b..637373e 100644 --- a/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.Lib/Day10.fs +++ b/AdventOfCode2023.FSharp/AdventOfCode2023.FSharp.Lib/Day10.fs @@ -88,7 +88,7 @@ module Day10 = let mutable pointB = let pos = ofRowAndCol lineLength (startLine - 1) startCol - match s.[pos] with + match if pos >= 0 then s.[pos] else 'n' with | '|' | '7' | 'F' -> pos @@ -96,7 +96,7 @@ module Day10 = let pos = ofRowAndCol lineLength (startLine + 1) startCol - match s.[pos] with + match if pos < s.Length then s.[pos] else 'n' with | '|' | 'L' | 'J' -> pos @@ -104,7 +104,7 @@ module Day10 = let pos = ofRowAndCol lineLength startLine (startCol + 1) - match s.[pos] with + match if pos < s.Length then s.[pos] else 'n' with | '-' | 'J' | '7' -> pos