diff options
Diffstat (limited to 'src/sprite_loader.rs')
| -rw-r--r-- | src/sprite_loader.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sprite_loader.rs b/src/sprite_loader.rs index eccf066..01d13aa 100644 --- a/src/sprite_loader.rs +++ b/src/sprite_loader.rs @@ -58,7 +58,11 @@ pub fn load_sprite_to_cells(path: &str) -> SpriteCells { Ok(SpriteManifest { palette }) => { let cells: Vec<Cell> = indices .iter() - .map(|i| Cell::from_material(palette.get(i).unwrap().material)) + .map(|i| { + Cell::from_material( + palette.get(i).map_or(MaterialId::Void, |v| v.material), + ) + }) .collect(); SpriteCells { |
