🆙 Fix Null error in SubscriptionHabboClub

This commit is contained in:
duckietm 2024-07-12 12:51:44 +02:00
parent f0be6533f0
commit 3a33720124

View File

@ -265,9 +265,15 @@ public class SubscriptionHabboClub extends Subscription {
try (ResultSet set = statement.executeQuery()) { try (ResultSet set = statement.executeQuery()) {
while (set.next()) { while (set.next()) {
try {
int userId = set.getInt("user_id"); int userId = set.getInt("user_id");
try {
HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId); HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId);
if (habboInfo == null) {
SubscriptionManager.LOGGER.error("HabboInfo is null for user #" + userId);
continue;
}
HabboStats stats = habboInfo.getHabboStats(); HabboStats stats = habboInfo.getHabboStats();
ClubCenterDataComposer calculated = calculatePayday(habboInfo); ClubCenterDataComposer calculated = calculatePayday(habboInfo);
int totalReward = (calculated.creditRewardForMonthlySpent + calculated.creditRewardForStreakBonus); int totalReward = (calculated.creditRewardForMonthlySpent + calculated.creditRewardForStreakBonus);
@ -279,7 +285,7 @@ public class SubscriptionHabboClub extends Subscription {
stats.lastHCPayday = timestampNow; stats.lastHCPayday = timestampNow;
Emulator.getThreading().run(stats); Emulator.getThreading().run(stats);
} catch (Exception e) { } catch (Exception e) {
SubscriptionManager.LOGGER.error("Exception processing HC payday for user #" + set.getInt("user_id"), e); SubscriptionManager.LOGGER.error("Exception processing HC payday for user #" + userId, e);
} }
} }
} }
@ -308,6 +314,7 @@ public class SubscriptionHabboClub extends Subscription {
isExecuting = false; isExecuting = false;
} }
/** /**
* Called when a user logs in. Checks for any unclaimed HC Pay day rewards and issues rewards. * Called when a user logs in. Checks for any unclaimed HC Pay day rewards and issues rewards.
* *