Skip to content

Commit

Permalink
Fix divide by zero when capacity is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelAquilina committed May 21, 2020
1 parent 79d47a6 commit 8ecd09e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/prompts/multi_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ impl<'a> MultiSelect<'a> {
self.items.len()
};

let pages = (self.items.len() / capacity) + 1;
let pages = if capacity == 0 {
return Ok(vec![]);
} else {
(self.items.len() / capacity) + 1
};

let mut render = TermThemeRenderer::new(term, self.theme);
let mut sel = 0;

Expand Down

0 comments on commit 8ecd09e

Please sign in to comment.