浏览代码

BETA: Fixing minor NPE vulnerability on TvT Manager.

Reported by: siphonex
Zoey76 11 年之前
父节点
当前提交
1836d8f319
共有 1 个文件被更改,包括 11 次插入5 次删除
  1. 11 5
      L2J_DataPack_BETA/dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java

+ 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
 	@Override
 	public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
 	public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
 	{
 	{
+		String html = null;
 		switch (command)
 		switch (command)
 		{
 		{
 			case "tvt":
 			case "tvt":
 			{
 			{
 				if (TvTEvent.isStarting() || TvTEvent.isStarted())
 				if (TvTEvent.isStarting() || TvTEvent.isStarted())
 				{
 				{
-					activeChar.sendPacket(new NpcHtmlMessage(getTvTStatus(activeChar)));
+					html = getTvTStatus(activeChar);
 				}
 				}
 				else
 				else
 				{
 				{
-					activeChar.sendMessage("The event has not started.");
+					html = "The event has not started.";
 				}
 				}
 				break;
 				break;
 			}
 			}
 			case "tvtjoin":
 			case "tvtjoin":
 			{
 			{
-				activeChar.sendPacket(new NpcHtmlMessage(onAdvEvent("join", null, activeChar)));
+				html = onAdvEvent("join", null, activeChar);
 				break;
 				break;
 			}
 			}
 			case "tvtleave":
 			case "tvtleave":
 			{
 			{
-				activeChar.sendPacket(new NpcHtmlMessage(onAdvEvent("remove", null, activeChar)));
+				html = onAdvEvent("remove", null, activeChar);
 				break;
 				break;
 			}
 			}
 		}
 		}
-		return false;
+		
+		if (html != null)
+		{
+			activeChar.sendPacket(new NpcHtmlMessage(html));
+		}
+		return true;
 	}
 	}
 	
 	
 	private String getTvTStatus(L2PcInstance player)
 	private String getTvTStatus(L2PcInstance player)