Skip to content

Commit d170aff

Browse files
authored
[gas profiler] fix table rendered (#17467)
Co-authored-by: Igor <[email protected]>
1 parent 59e501b commit d170aff

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

aptos-move/aptos-gas-profiling/src/render.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,13 @@ pub struct TableKey<'a> {
9393

9494
impl Display for TableKey<'_> {
9595
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
96-
assert!(self.bytes.len() > 2);
97-
write!(f, "0x{:02x}{:02x}..", self.bytes[0], self.bytes[1])
96+
if self.bytes.is_empty() {
97+
write!(f, "0x")
98+
} else if self.bytes.len() == 1 {
99+
write!(f, "0x{:02x}", self.bytes[0])
100+
} else {
101+
write!(f, "0x{:02x}{:02x}..", self.bytes[0], self.bytes[1])
102+
}
98103
}
99104
}
100105

0 commit comments

Comments
 (0)