webgl: Don't panic when trying to draw unregistered bitmap

Avoids a panic in #1248.
This commit is contained in:
Mike Welsh 2020-10-11 01:18:01 -07:00
parent 4034ef8d79
commit 253c231788
1 changed files with 8 additions and 6 deletions

View File

@ -1048,12 +1048,14 @@ impl RenderBackend for WebGlRenderBackend {
);
}
DrawType::Bitmap(bitmap) => {
let texture = &self
.textures
.iter()
.find(|(id, _tex)| *id == bitmap.id)
.unwrap()
.1;
let texture = if let Some(texture) =
self.textures.iter().find(|(id, _tex)| *id == bitmap.id)
{
&texture.1
} else {
// Bitmap not registered
continue;
};
program.uniform_matrix3fv(
&self.gl,