Просмотр исходного кода

BETA: Fixing minor NPE vulnerability on TvT Manager.

Reported by: siphonex
Zoey76 11 лет назад
Родитель
Сommit
1836d8f319

+ 11 - 5
L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java

@@ -163,32 +163,38 @@ public final class TvTManager extends AbstractNpcAI implements IVoicedCommandHan
 	@Override
 	public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
 	{
+		String html = null;
 		switch (command)
 		{
 			case "tvt":
 			{
 				if (TvTEvent.isStarting() || TvTEvent.isStarted())
 				{
-					activeChar.sendPacket(new NpcHtmlMessage(getTvTStatus(activeChar)));
+					html = getTvTStatus(activeChar);
 				}
 				else
 				{
-					activeChar.sendMessage("The event has not started.");
+					html = "The event has not started.";
 				}
 				break;
 			}
 			case "tvtjoin":
 			{
-				activeChar.sendPacket(new NpcHtmlMessage(onAdvEvent("join", null, activeChar)));
+				html = onAdvEvent("join", null, activeChar);
 				break;
 			}
 			case "tvtleave":
 			{
-				activeChar.sendPacket(new NpcHtmlMessage(onAdvEvent("remove", null, activeChar)));
+				html = onAdvEvent("remove", null, activeChar);
 				break;
 			}
 		}
-		return false;
+		
+		if (html != null)
+		{
+			activeChar.sendPacket(new NpcHtmlMessage(html));
+		}
+		return true;
 	}
 	
 	private String getTvTStatus(L2PcInstance player)