diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e19b0f..12e4da3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.4.2] - 2025-07-13 +### Fixed +- Fix crash when head profile name is null (fixes [#60](https://github.com/Suiranoil/SkinRestorer/issues/60) and [#61](https://github.com/Suiranoil/SkinRestorer/issues/61)) + ## [2.4.1] - 2025-07-09 ### Changed - Log full exception and argument when unable to fetch/set skin diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index b1a2a73..bf4e1a8 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -1,4 +1,2 @@ -### Changed -- Log full exception and argument when unable to fetch/set skin ### Fixed -- Fixed mojang provider using offline uuids when unable to fetch actual uuid resulting in `no profile with uuid` error +- Fix crash when head profile name is null (fixes [#60](https://github.com/Suiranoil/SkinRestorer/issues/60) and [#61](https://github.com/Suiranoil/SkinRestorer/issues/61)) diff --git a/common/src/main/java/net/lionarius/skinrestorer/mixin/SkullBlockEntityMixin.java b/common/src/main/java/net/lionarius/skinrestorer/mixin/SkullBlockEntityMixin.java index e90370a..5415368 100644 --- a/common/src/main/java/net/lionarius/skinrestorer/mixin/SkullBlockEntityMixin.java +++ b/common/src/main/java/net/lionarius/skinrestorer/mixin/SkullBlockEntityMixin.java @@ -22,6 +22,9 @@ public abstract class SkullBlockEntityMixin { @Inject(method = "fetchProfileByName", at = @At("HEAD"), cancellable = true) private static void fetchProfileByName(String name, Services services, CallbackInfoReturnable>> cir) { + if (name == null) + return; + var profileOpt = services.profileCache().get(name); skinrestorer$replaceSkin(profileOpt, cir); @@ -30,6 +33,9 @@ public abstract class SkullBlockEntityMixin { @Inject(method = "fetchProfileById", at = @At("HEAD"), cancellable = true) private static void fetchProfileById(UUID id, Services services, BooleanSupplier cacheUninitialized, CallbackInfoReturnable>> cir) { + if (id == null) + return; + var profileOpt = services.profileCache().get(id); skinrestorer$replaceSkin(profileOpt, cir); diff --git a/gradle.properties b/gradle.properties index 290aa4b..9314c48 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ minecraft_version_list=1.21,1.21.1,1.21.2,1.21.3,1.21.4 minecraft_version_range=[1.21, 1.21.4] mod_id=skinrestorer mod_name=SkinRestorer -mod_version=2.4.1 +mod_version=2.4.2 mod_author=Lionarius mod_homepage=https://modrinth.com/mod/skinrestorer mod_sources=https://github.com/Suiranoil/SkinRestorer