L2JMobius

C6 Summon Friend skill exception

Strelook66 · 7 · 249

Online Strelook66

  • Knight
  • ***
    • Posts: 77
Hi,

An exception happens whenever you use the skill Summon Friend (ID: 1403). The requester casts the skill and sends the information to the targeted player. The player then answers via the dialogue with ok for teleportation. The requested player is moved to the location but the game console throws this exception:

Code: [Select]
Exception for: [Character: Test2[268485139] - Account: test3 - IP: 127.0.0.1] on packet.run: DlgAnswer
java.lang.NullPointerException: Cannot invoke "org.l2jmobius.gameserver.model.actor.instance.PlayerInstance.getX()" because "summoner" is null
at org.l2jmobius.gameserver.model.holders.SummonRequestHolder.setTarget(SummonRequestHolder.java:35)
at org.l2jmobius.gameserver.model.actor.instance.PlayerInstance.teleportAnswer(PlayerInstance.java:12636)
at org.l2jmobius.gameserver.network.clientpackets.DlgAnswer.run(DlgAnswer.java:66)
at org.l2jmobius.gameserver.network.clientpackets.DlgAnswer.run(DlgAnswer.java:29)
at org.l2jmobius.gameserver.network.GameClient.channelRead0(GameClient.java:132)
at org.l2jmobius.gameserver.network.GameClient.channelRead0(GameClient.java:70)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:831)

In short, the desired outcome works, but the console gets flooded every time this is used.


Online Mobius

  • Administrator
  • Distinguished King
  • *****
    • Posts: 11579
Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/model/holders/SummonRequestHolder.java
===================================================================
--- java/org/l2jmobius/gameserver/model/holders/SummonRequestHolder.java (revision 9736)
+++ java/org/l2jmobius/gameserver/model/holders/SummonRequestHolder.java (working copy)
@@ -32,7 +32,7 @@
  public void setTarget(PlayerInstance summoner, Skill skill)
  {
  _summoner = summoner;
- _location = new Location(summoner.getX(), summoner.getY(), summoner.getZ(), summoner.getHeading());
+ _location = summoner == null ? null : new Location(summoner.getX(), summoner.getY(), summoner.getZ(), summoner.getHeading());
  _skill = skill;
  }
 



Offline ver

  • Knight
  • ***
    • Posts: 68
Hm...

Wouldn't that be better?
Code: [Select]
_location = summoner == null ? Location.DUMMY_LOC : new Location(summoner.getX(), summoner.getY(), summoner.getZ(), summoner.getHeading());


Online Mobius

  • Administrator
  • Distinguished King
  • *****
    • Posts: 11579
Hm...

Wouldn't that be better?
Code: [Select]
_location = summoner == null ? Location.DUMMY_LOC : new Location(summoner.getX(), summoner.getY(), summoner.getZ(), summoner.getHeading());

That is a bad idea.
It is explicitly set to null by the method using it.