diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx index 7c4b99b7819..ba668dde040 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx @@ -114,7 +114,9 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({ const filename: string | null = arrowToString(filenameColumn?.get(row)); const depth: number = depthColumn?.get(row) ?? 0; const valueOffset: bigint = - valueOffsetColumn?.get(row) !== null ? BigInt(valueOffsetColumn?.get(row)) : 0n; + valueOffsetColumn?.get(row) !== null && valueOffsetColumn?.get(row) !== undefined + ? BigInt(valueOffsetColumn?.get(row)) + : 0n; const colorAttribute = colorBy === 'filename' ? filename : colorBy === 'binary' ? mappingFile : null; @@ -147,7 +149,10 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({ }, [searchString, name]); const selectionOffset = - valueOffsetColumn?.get(selectedRow) !== null ? BigInt(valueOffsetColumn?.get(selectedRow)) : 0n; + valueOffsetColumn?.get(selectedRow) !== null && + valueOffsetColumn?.get(selectedRow) !== undefined + ? BigInt(valueOffsetColumn?.get(selectedRow)) + : 0n; const selectionCumulative = cumulativeColumn?.get(selectedRow) !== null ? BigInt(cumulativeColumn?.get(selectedRow)) : 0n; if ( diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx index 5f2c9ca9bdf..d3c76eb4abc 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx @@ -106,6 +106,17 @@ export const getFilenameColors = ( const noop = (): void => {}; +function getMaxDepth(depthColumn: Vector | null): number { + if (depthColumn === null) return 0; + + let max = 0; + for (const val of depthColumn) { + const numVal = Number(val); + if (numVal > max) max = numVal; + } + return max; +} + export const IcicleGraphArrow = memo(function IcicleGraphArrow({ arrow, total, @@ -237,7 +248,7 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({ }; const depthColumn = table.getChild(FIELD_DEPTH); - const maxDepth = depthColumn === null ? 0 : Math.max(...depthColumn.toArray()); + const maxDepth = getMaxDepth(depthColumn); const height = maxDepth * RowHeight; // To find the selected row, we must walk the current path and look at which