From 1ce1cea068e526b4c9835de8e0d4d2ea6d76a5c0 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Tue, 10 Aug 2021 16:45:42 +0200 Subject: [PATCH] Add bounds check (probably unnecessary) --- src/runtime/haskell/LPGF.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/haskell/LPGF.hs b/src/runtime/haskell/LPGF.hs index 5f977a29a..222797d58 100644 --- a/src/runtime/haskell/LPGF.hs +++ b/src/runtime/haskell/LPGF.hs @@ -154,7 +154,7 @@ eval cxt t = case t of Projection t u -> case (eval cxt t, eval cxt u) of (Missing f, _) -> Missing f - (Tuple vs, Missing _) -> vs !! 0 -- imitate PGF behaviour + (Tuple vs, Missing _) | not (null vs) -> vs !! 0 -- cannot know how deep to unpack; this gives best results with current testsuite (_, Missing f) -> Missing f (Tuple vs, Ix i) -> vs !! (i-1) (t', tv@(Tuple _)) -> eval cxt $ foldl Projection t' (flattenTuple tv)