From 9c4a4a16f309bc5b81cd8331954134a90f454625 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Tue, 7 Jul 2015 08:34:16 -0200 Subject: [PATCH] [inferconfig] don't fail during filtering if a file does not exist --- infer/src/backend/inferconfig.ml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/infer/src/backend/inferconfig.ml b/infer/src/backend/inferconfig.ml index ff87d7a2a..bab9a70af 100644 --- a/infer/src/backend/inferconfig.ml +++ b/infer/src/backend/inferconfig.ml @@ -95,11 +95,13 @@ module FileContainsStringMatcher = struct try DB.SourceFileMap.find source_file !source_map with Not_found -> - let file_in = open_in (DB.source_file_to_string source_file) in - let pattern_found = file_contains regexp file_in in - close_in file_in; - source_map := DB.SourceFileMap.add source_file pattern_found !source_map; - pattern_found + try + let file_in = open_in (DB.source_file_to_string source_file) in + let pattern_found = file_contains regexp file_in in + close_in file_in; + source_map := DB.SourceFileMap.add source_file pattern_found !source_map; + pattern_found + with Sys_error _ -> false end let filters_from_inferconfig inferconfig : filters =