|
@@ -17,10 +17,15 @@ func (mc *Handler) DownloadSkin() {
|
|
|
log.Println("Error when reading profiles. Download aborted.")
|
|
|
copy("default_skin.png", mc.savePath+"/"+mc.UUID+".png")
|
|
|
} else {
|
|
|
- decoded, _ := base64.URLEncoding.DecodeString(profileArray.Properties[0].Value)
|
|
|
- var textureArray texture
|
|
|
- json.Unmarshal([]byte(decoded), &textureArray)
|
|
|
- downloadFile(mc.savePath+"/"+mc.UUID+".png", textureArray.Textures.SKIN.URL)
|
|
|
+ if len(profileArray.Properties) > 0 {
|
|
|
+ decoded, _ := base64.URLEncoding.DecodeString(profileArray.Properties[0].Value)
|
|
|
+ var textureArray texture
|
|
|
+ json.Unmarshal([]byte(decoded), &textureArray)
|
|
|
+ downloadFile(mc.savePath+"/"+mc.UUID+".png", textureArray.Textures.SKIN.URL)
|
|
|
+ } else {
|
|
|
+ copy("default_skin.png", mc.savePath+"/"+mc.UUID+".png")
|
|
|
+ log.Println("Error when reading profiles. Download aborted.")
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
//log.Println("Skin exists, not downloading")
|