From a6789755778f2c196d1c61804f11b69c614c82ec Mon Sep 17 00:00:00 2001 From: Dan D'Avella Date: Tue, 30 Apr 2024 15:16:46 -0400 Subject: [PATCH] Handle case where CodeQL location doesn't have region (#532) --- src/codemodder/codeql.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/codemodder/codeql.py b/src/codemodder/codeql.py index d44437e9..bfce9e82 100644 --- a/src/codemodder/codeql.py +++ b/src/codemodder/codeql.py @@ -45,7 +45,12 @@ def from_sarif( locations: list[Location] = [] for location in sarif_result["locations"]: - codeql_location = CodeQLLocation.from_sarif(location) + try: + codeql_location = CodeQLLocation.from_sarif(location) + except KeyError: + # TODO: handle this case more gracefully + continue + locations.append(codeql_location) return cls(rule_id=rule_data["id"], locations=locations)