fix(Menu): unselect if there are no menu items

This commit is contained in:
CJ van den Berg 2024-06-27 21:19:07 +02:00
parent bd87f29cf2
commit b3388eed77

View file

@ -167,7 +167,10 @@ pub fn State(ctx_type: type) type {
self.selected = 0;
return;
};
self.selected = @min(current + 1, self.count() - self.header_count - 1);
self.selected = if (self.count() < self.header_count + 1)
null
else
@min(current + 1, self.count() - self.header_count - 1);
}
pub fn select_up(self: *Self) void {