Use default skin if a malformed skin is provided
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
@@ -193,7 +194,11 @@ func GetPlayerSkin(uuid string) (*image.NRGBA, bool, error) {
|
|||||||
// Fetch the raw skin image from the Mojang API
|
// Fetch the raw skin image from the Mojang API
|
||||||
{
|
{
|
||||||
if skinImage, err = FetchImage(texturesProperty.Textures.Skin.URL); err != nil {
|
if skinImage, err = FetchImage(texturesProperty.Textures.Skin.URL); err != nil {
|
||||||
return nil, false, err
|
if !errors.Is(err, image.ErrFormat) {
|
||||||
|
return nil, false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
skinImage = skin.GetDefaultSkin(isSlim)
|
||||||
}
|
}
|
||||||
|
|
||||||
if rawSkin, err = EncodePNG(skinImage); err != nil {
|
if rawSkin, err = EncodePNG(skinImage); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user