mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-23 07:14:01 +00:00
Fix texture_as_hal
internal unwrap may cause panic (#3131)
This commit is contained in:
parent
d81cb46be0
commit
dcc0baa1ff
@ -385,7 +385,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
let mut token = Token::root();
|
let mut token = Token::root();
|
||||||
let (guard, _) = hub.textures.read(&mut token);
|
let (guard, _) = hub.textures.read(&mut token);
|
||||||
let texture = guard.try_get(id).ok().flatten();
|
let texture = guard.try_get(id).ok().flatten();
|
||||||
let hal_texture = texture.map(|tex| tex.inner.as_raw().unwrap());
|
let hal_texture = texture.and_then(|tex| tex.inner.as_raw());
|
||||||
|
|
||||||
hal_texture_callback(hal_texture);
|
hal_texture_callback(hal_texture);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user