Fix amounts out of range

This commit is contained in:
timokoesters 2020-03-19 16:51:50 +01:00
parent 0bb0d5e7a6
commit 6c129c9b8d

View File

@ -583,6 +583,20 @@ impl<'a> Widget for Bag<'a> {
.resize(inventory.len(), &mut ui.widget_id_generator());
});
}
if state.ids.amounts.len() < inventory.len() {
state.update(|s| {
s.ids
.amounts
.resize(inventory.len(), &mut ui.widget_id_generator());
});
}
if state.ids.amounts_bg.len() < inventory.len() {
state.update(|s| {
s.ids
.amounts_bg
.resize(inventory.len(), &mut ui.widget_id_generator());
});
}
// Expand img id cache to the number of slots
if state.img_id_cache.len() < inventory.len() {
state.update(|s| {