From e52f8dda61537bdd0ae156cfeeed83533ab1c76b Mon Sep 17 00:00:00 2001 From: krasimir Date: Fri, 17 Dec 2010 09:09:07 +0000 Subject: [PATCH] bugfix: setProbabilities should be more robust when there are missing probabilities for some functions or categories --- src/runtime/haskell/PGF/Probabilistic.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/haskell/PGF/Probabilistic.hs b/src/runtime/haskell/PGF/Probabilistic.hs index 1a75b60a6..ee44e73e1 100644 --- a/src/runtime/haskell/PGF/Probabilistic.hs +++ b/src/runtime/haskell/PGF/Probabilistic.hs @@ -80,7 +80,7 @@ setProbabilities probs pgf = pgf { }} where mapUnionWith f map1 map2 = - Map.mapWithKey (\k v -> f v (fromJust (Map.lookup k map2))) map1 + Map.mapWithKey (\k v -> maybe v (f v) (Map.lookup k map2)) map1 -- | compute the probability of a given tree probTree :: PGF -> Expr -> Double