diff options
author | Paul Woolcock <paul@woolcock.us> | 2019-03-06 06:27:52 -0500 |
---|---|---|
committer | Paul Woolcock <paul@woolcock.us> | 2019-03-06 06:27:52 -0500 |
commit | 5e69ad4b3306e6459e4861fb9228b1bc95c0d809 (patch) | |
tree | eeb33bbf11989c04b3152e441747ad8c098225fd /src | |
parent | dd720348495e877c23b713978b7e6f82cb384fa8 (diff) |
Fix panic if there are < page number of results
Diffstat (limited to 'src')
-rw-r--r-- | src/entities/itemsiter.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/entities/itemsiter.rs b/src/entities/itemsiter.rs index 96cd20e..e8b3e76 100644 --- a/src/entities/itemsiter.rs +++ b/src/entities/itemsiter.rs @@ -53,6 +53,9 @@ impl<'a, T: Clone + for<'de> Deserialize<'de>, H: HttpSend> ItemsIter<'a, T, H> return None; }; if let Some(items) = items { + if items.is_empty() { + return None; + } self.buffer = items; self.cur_idx = 0; Some(()) @@ -67,7 +70,7 @@ impl<'a, T: Clone + for<'de> Deserialize<'de>, H: HttpSend> Iterator for ItemsIt fn next(&mut self) -> Option<Self::Item> { if self.use_initial { - if self.page.initial_items.is_empty() { + if self.page.initial_items.is_empty() || self.cur_idx == self.page.initial_items.len() { return None; } let idx = self.cur_idx; |