diff --git a/src/main/java/cc/moecraft/icq/user/GroupManager.java b/src/main/java/cc/moecraft/icq/user/GroupManager.java index e696967d..3ca6d717 100644 --- a/src/main/java/cc/moecraft/icq/user/GroupManager.java +++ b/src/main/java/cc/moecraft/icq/user/GroupManager.java @@ -29,11 +29,10 @@ public class GroupManager */ public Group getGroupFromID(long id) { - if (groupCache.containsKey(id)) + if (!groupCache.containsKey(id)) { - return groupCache.get(id); + groupCache.put(id, new Group(bot, id)); } - groupCache.put(id, new Group(bot, id)); - return getGroupFromID(id); + return groupCache.get(id); } } diff --git a/src/main/java/cc/moecraft/icq/user/UserManager.java b/src/main/java/cc/moecraft/icq/user/UserManager.java index 98afe264..1f3f055e 100644 --- a/src/main/java/cc/moecraft/icq/user/UserManager.java +++ b/src/main/java/cc/moecraft/icq/user/UserManager.java @@ -29,11 +29,10 @@ public class UserManager */ public User getUserFromID(long id) { - if (userCache.containsKey(id)) + if (!userCache.containsKey(id)) { - return userCache.get(id); + userCache.put(id, new User(bot, id)); } - userCache.put(id, new User(bot, id)); - return getUserFromID(id); + return userCache.get(id); } }