From 7ee7a4e9759ebd97b2125a16f504424095adeff7 Mon Sep 17 00:00:00 2001 From: Obique Date: Thu, 7 Feb 2019 09:13:10 -0600 Subject: [PATCH] Fixed null checks and improved logging in EntertainmentService --- .../gameplay/entertainment/EntertainmentService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/projectswg/holocore/services/gameplay/entertainment/EntertainmentService.java b/src/main/java/com/projectswg/holocore/services/gameplay/entertainment/EntertainmentService.java index dbe2fe3f2..94e0a17b1 100644 --- a/src/main/java/com/projectswg/holocore/services/gameplay/entertainment/EntertainmentService.java +++ b/src/main/java/com/projectswg/holocore/services/gameplay/entertainment/EntertainmentService.java @@ -38,6 +38,7 @@ import com.projectswg.holocore.intents.gameplay.player.experience.ExperienceInte import com.projectswg.holocore.intents.support.global.chat.SystemMessageIntent; import com.projectswg.holocore.intents.support.global.zone.PlayerEventIntent; import com.projectswg.holocore.intents.support.global.zone.PlayerTransformedIntent; +import com.projectswg.holocore.resources.support.data.server_info.StandardLog; import com.projectswg.holocore.resources.support.data.server_info.loader.DataLoader; import com.projectswg.holocore.resources.support.data.server_info.loader.PerformanceLoader.PerformanceInfo; import com.projectswg.holocore.resources.support.global.player.Player; @@ -418,12 +419,17 @@ public class EntertainmentService extends Service { Performance performance = performerMap.get(performer.getObjectId()); if (performance == null) { - Log.e("Performer %s wasn't in performermap", performer); + StandardLog.onPlayerError(this, performer, "is not in performerMap"); return; } String performanceName = performance.getPerformanceName(); PerformanceInfo performanceData = DataLoader.performances().getPerformanceByName(performanceName); + if (performanceData == null) { + StandardLog.onPlayerError(this, performer, "was performing unknown performance: '%s'", performanceName); + return; + } + int flourishXpMod = performanceData.getFlourishXpMod(); int performanceCounter = performer.getPerformanceCounter(); int xpGained = performanceCounter * flourishXpMod;