Ver Fonte

BETA: Minor NPE vulnerability fix.
* Reported by: blacksea
* Tested by: blacksea

Zoey76 há 11 anos atrás
pai
commit
45cd9766d4

+ 8 - 3
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java

@@ -106,13 +106,18 @@ public final class SummonCubic extends AbstractEffect
 		else
 		{
 			// If maximum amount is reached, random cubic is removed.
-			final BuffInfo cubicMastery = player.getEffectList().getBuffInfoBySkillId(L2Skill.SKILL_CUBIC_MASTERY);
 			// Players with no mastery can have only one cubic.
 			int allowedCubicCount = 1;
-			for (AbstractEffect effect : cubicMastery.getEffects())
+			// TODO: Unhardcode skill ID check so effect could work on any skill.
+			if (player.isAffectedBySkill(L2Skill.SKILL_CUBIC_MASTERY))
 			{
-				allowedCubicCount += effect != null ? effect.getValue() : 0;
+				final BuffInfo cubicMastery = player.getEffectList().getBuffInfoBySkillId(L2Skill.SKILL_CUBIC_MASTERY);
+				for (AbstractEffect effect : cubicMastery.getEffects())
+				{
+					allowedCubicCount += effect != null ? effect.getValue() : 0;
+				}
 			}
+			
 			final int currentCubicCount = player.getCubics().size();
 			// Extra cubics are removed, one by one, randomly.
 			for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)