L2JMobius

Free Users => Solved/Invalid Bug Reports => Topic started by: Strelook66 on January 16, 2022, 12:32:25 AM

Title: Summon Friend skill exception
Post by: Strelook66 on January 16, 2022, 12:32:25 AM
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.
Title: Re: Summon Friend skill exception
Post by: Mobius on January 16, 2022, 05:50:30 AM
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;
  }
 
Title: Re: Summon Friend skill exception
Post by: Strelook66 on January 16, 2022, 09:02:51 AM
Yeah, it works. Thanks  :D
Title: Re: Summon Friend skill exception
Post by: ver on January 16, 2022, 12:19:01 PM
Hm...

Wouldn't that be better?
Code: [Select]
_location = summoner == null ? Location.DUMMY_LOC : new Location(summoner.getX(), summoner.getY(), summoner.getZ(), summoner.getHeading());
Title: Re: Summon Friend skill exception
Post by: Mobius on January 16, 2022, 02:37:20 PM
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.
Title: Re: Summon Friend skill exception
Post by: ver on January 16, 2022, 04:55:00 PM
(https://upload.wikimedia.org/wikipedia/en/thumb/e/e3/Turbored.jpg/220px-Turbored.jpg)
Title: Re: Summon Friend skill exception
Post by: Mobius on January 17, 2022, 05:14:00 AM
Fixed with https://bitbucket.org/MobiusDev/l2j_mobius/commits/870ee0e839267dcbb083c01ae415d113ac268a56