Certainly fix the crash when getting avatar.

This commit is contained in:
IQuant 2024-09-26 21:27:44 +03:00
parent 21826ae4b3
commit 54fb09a7a7
2 changed files with 7 additions and 4 deletions

View file

@ -3211,7 +3211,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "steamworks" name = "steamworks"
version = "0.11.0" version = "0.11.0"
source = "git+https://github.com/IntQuant/steamworks-rs#d05eaa60db328156aeee172b0b157f3f69c70b30" source = "git+https://github.com/IntQuant/steamworks-rs#d765c925e2c481a3e6eb3ecdff12e09dcd618f26"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"lazy_static", "lazy_static",
@ -3223,7 +3223,7 @@ dependencies = [
[[package]] [[package]]
name = "steamworks-sys" name = "steamworks-sys"
version = "0.11.0" version = "0.11.0"
source = "git+https://github.com/IntQuant/steamworks-rs#d05eaa60db328156aeee172b0b157f3f69c70b30" source = "git+https://github.com/IntQuant/steamworks-rs#d765c925e2c481a3e6eb3ecdff12e09dcd618f26"
[[package]] [[package]]
name = "strict-num" name = "strict-num"

View file

@ -74,10 +74,13 @@ impl SteamState {
let friend = friends.get_friend(id); let friend = friends.get_friend(id);
friend friend
.small_avatar() .small_avatar()
.map(|data| { .map(|(width, height, data)| {
ctx.load_texture( ctx.load_texture(
format!("steam_avatar_for_{:?}", id), format!("steam_avatar_for_{:?}", id),
ColorImage::from_rgba_unmultiplied([32, 32], &data), ColorImage::from_rgba_unmultiplied(
[width as usize, height as usize],
&data,
),
TextureOptions::LINEAR, TextureOptions::LINEAR,
) )
}) })