Skip to content

Commit 1918212

Browse files
authored
Ignore undefined updatedPosition data (#38)
1 parent 796a8af commit 1918212

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: src/print-trace-analysis-json.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,10 @@ async function getHotSpotsWorker(curr: EventSpan, currentFile: string | undefine
212212
if (type.location) {
213213
const path = type.location.path;
214214
if (positionMap.has(path)) {
215-
const updatedPosition = positionMap.get(path)!.get(getLineCharMapKey(type.location.line, type.location.char))!;
216-
[ type.location.line, type.location.char ] = updatedPosition;
215+
const updatedPosition = positionMap.get(path)!.get(getLineCharMapKey(type.location.line, type.location.char));
216+
if (updatedPosition) {
217+
[ type.location.line, type.location.char ] = updatedPosition;
218+
}
217219
type.location.path = formatPath(path);
218220
}
219221
}
@@ -257,4 +259,4 @@ function formatPath(p: string) {
257259

258260
function undefinedIfEmpty<T>(arr: T[]): T[] | undefined {
259261
return arr.length ? arr : undefined;
260-
}
262+
}

0 commit comments

Comments
 (0)