mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-04 02:24:11 +02:00
fix crash with empty tables
This commit is contained in:
parent
668512a767
commit
8f0e443275
1 changed files with 6 additions and 0 deletions
|
|
@ -78,6 +78,9 @@ impl ScrollbarTableState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn up(&mut self, step: usize, rollover: bool) -> usize {
|
pub fn up(&mut self, step: usize, rollover: bool) -> usize {
|
||||||
|
if self.count == 0 {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
let current = self.table.selected().unwrap_or(0);
|
let current = self.table.selected().unwrap_or(0);
|
||||||
let after = if step > current {
|
let after = if step > current {
|
||||||
if rollover {
|
if rollover {
|
||||||
|
|
@ -94,6 +97,9 @@ impl ScrollbarTableState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn down(&mut self, step: usize, rollover: bool) -> usize {
|
pub fn down(&mut self, step: usize, rollover: bool) -> usize {
|
||||||
|
if self.count == 0 {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
let current = self.table.selected().unwrap_or(0);
|
let current = self.table.selected().unwrap_or(0);
|
||||||
let after = if step >= self.count - current {
|
let after = if step >= self.count - current {
|
||||||
if rollover {
|
if rollover {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue