Skip to content

Commit 2f26a07

Browse files
authored
Fix local profile cache. (#327)
1 parent 5764d81 commit 2f26a07

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

Common/src/main/java/customskinloader/CustomSkinLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public static UserProfile loadProfile0(GameProfile gameProfile, boolean isSkull)
180180

181181
if (config.enableLocalProfileCache) {
182182
UserProfile profile = profileCache.getLocalProfile(credential);
183-
if (profile == null) {
183+
if (profile == null || profile.equals(UserProfile.NULL)) {
184184
logger.info(username + "'s LocalProfile not found.");
185185
} else {
186186
profileCache.updateCache(credential, profile, false);

Common/src/main/java/customskinloader/profile/ProfileCache.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private CachedProfile getCachedProfile(String username){
8989
private UserProfile loadLocalProfile(String username){
9090
File localProfile=new File(PROFILE_CACHE_DIR,username.toLowerCase()+".json");
9191
if(!localProfile.exists()){
92-
localProfiles.put(username.toLowerCase(), null);
92+
localProfiles.put(username.toLowerCase(), UserProfile.NULL);
9393
}
9494
try{
9595
String json = FileUtils.readFileToString(localProfile, "UTF-8");
@@ -99,9 +99,9 @@ private UserProfile loadLocalProfile(String username){
9999
return profile;
100100
}catch(Exception e){
101101
CustomSkinLoader.logger.info("Failed to load LocalProfile.("+e.toString()+")");
102-
localProfiles.put(username.toLowerCase(), null);
102+
localProfiles.put(username.toLowerCase(), UserProfile.NULL);
103103
}
104-
return null;
104+
return UserProfile.NULL;
105105
}
106106
@SuppressWarnings("ResultOfMethodCallIgnored")
107107
private void saveLocalProfile(String username, UserProfile profile){

Common/src/main/java/customskinloader/profile/UserProfile.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* @since 13.1
1616
*/
1717
public class UserProfile {
18+
19+
public final static UserProfile NULL = new UserProfile();
1820

1921
/**
2022
* Direct url for skin.

build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name=CustomSkinLoader
22
group=customskinloader
3-
version=14.22
3+
version=14.22.1

0 commit comments

Comments
 (0)