diff options
Diffstat (limited to 'vendor/libghostty-vt/src/terminal/ref_counted_set.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/terminal/ref_counted_set.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/terminal/ref_counted_set.zig b/vendor/libghostty-vt/src/terminal/ref_counted_set.zig index 8040039a..dd76079f 100644 --- a/vendor/libghostty-vt/src/terminal/ref_counted_set.zig +++ b/vendor/libghostty-vt/src/terminal/ref_counted_set.zig @@ -497,6 +497,15 @@ pub fn RefCountedSet( return self.lookupContext(base, value, self.context); } pub fn lookupContext(self: *const Self, base: anytype, value: T, ctx: Context) ?Id { + // A zero-capacity set (a valid special case of Layout.init) + // contains nothing and has a zero-size table, so we can't + // probe it: table[0] would read whatever memory follows the + // set in the backing buffer. + if (self.layout.table_cap == 0) { + @branchHint(.cold); + return null; + } + const table = self.table.ptr(base); const items = self.items.ptr(base); |
