Skip to content

Commit 65777b5

Browse files
committed
Use null-aware accessors in getResult
1 parent 53bb9d7 commit 65777b5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

extensions/ql-vscode/src/pure/result-keys.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ export type ResultKey = Result | Path | PathNode;
4040
* Looks up a specific result in a result set.
4141
*/
4242
export function getResult(sarif: sarif.Log, key: Result | Path | PathNode): sarif.Result | undefined {
43-
if (sarif.runs.length === 0) return undefined;
44-
if (sarif.runs[0].results === undefined) return undefined;
45-
const results = sarif.runs[0].results;
46-
return results[key.resultIndex];
43+
return sarif.runs[0]?.results?.[key.resultIndex];
4744
}
4845

4946
/**

0 commit comments

Comments
 (0)