Fix texture_as_hal internal unwrap may cause panic (#3131)

This commit is contained in:
Jinlei Li authored and GitHub committed 2022-10-26 17:13:43 -04:00
1 parent d81cb46be0
commit dcc0baa1ff
1 file changed
+1 -1
+1 -1
View File
@@ -385,7 +385,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let mut token = Token::root();
let (guard, _) = hub.textures.read(&mut token);
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);
}