From 7110c1ca3f3db7d1b95edc021eee84cf77bbf0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezgi=20=C3=87i=C3=A7ek?= Date: Thu, 11 Mar 2021 02:05:31 -0800 Subject: [PATCH] [litho] Handle non-existing caller path Reviewed By: skcho Differential Revision: D26975222 fbshipit-source-id: 758c4f0b3 --- infer/src/checkers/LithoDomain.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/infer/src/checkers/LithoDomain.ml b/infer/src/checkers/LithoDomain.ml index 6e81c39b1..b7c8a4ec5 100644 --- a/infer/src/checkers/LithoDomain.ml +++ b/infer/src/checkers/LithoDomain.ml @@ -130,9 +130,10 @@ module Created = struct | CreatedLocation.ByCreateMethod _ -> append_one caller_return callee_return acc | CreatedLocation.ByParameter path -> - let caller_path = SubstPathMap.find path map in - Option.value_map (find_opt caller_path caller) ~default:acc ~f:(fun caller_created -> - append caller_return caller_created acc ) + SubstPathMap.find_opt path map + |> Option.value_map ~default:acc ~f:(fun caller_path -> + Option.value_map (find_opt caller_path caller) ~default:acc + ~f:(fun caller_created -> append caller_return caller_created acc) ) in CreatedLocations.fold accum_subst callee_returns acc )