null pointer exception

    Share
    avatar
    Karakan

    Posts : 405
    Join date : 2013-10-04

    null pointer exception

    Post  Karakan on 3rd September 2015, 16:11

    Anyone else getting this npe in latest rev. ?


    Code:
    java.lang.NullPointerException
            at net.sf.l2j.gameserver.model.L2Attackable.doDie(L2Attackable.java:428)

            at net.sf.l2j.gameserver.model.actor.instance.L2MonsterInstance.doDie(L2
    MonsterInstance.java:206)
            at net.sf.l2j.gameserver.model.actor.instance.L2MinionInstance.doDie(L2M
    inionInstance.java:102)
            at net.sf.l2j.gameserver.model.actor.status.CharStatus.reduceHp(CharStat
    us.java:180)
            at net.sf.l2j.gameserver.model.actor.status.NpcStatus.reduceHp(NpcStatus
    .java:49)
            at net.sf.l2j.gameserver.model.L2Character.reduceCurrentHp(L2Character.j
    ava:6016)
            at net.sf.l2j.gameserver.model.L2Attackable.reduceCurrentHp(L2Attackable
    .java:381)
            at net.sf.l2j.gameserver.model.L2Attackable.reduceCurrentHp(L2Attackable
    .java:358)
            at net.sf.l2j.gameserver.model.zone.type.L2DamageZone$ApplyDamage.run(L2
    DamageZone.java:95)
            at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
            at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
    access$301(Unknown Source)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
    run(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: null pointer exception

    Post  DnR on 3rd September 2015, 16:25

    Have you updated properly?

    Line 428 is actually a null check and the code should be like this:
    Code:

            try
            {
                L2PcInstance player = killer.getActingPlayer();
                if (player != null)
                {
                    if (getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL) != null)
                    {
                        for (Quest quest : getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL))
                            quest.notifyKill(this, player, killer instanceof L2Summon);
                    }
                }
            }
    avatar
    Karakan

    Posts : 405
    Join date : 2013-10-04

    Re: null pointer exception

    Post  Karakan on 3rd September 2015, 16:34

    Thanks for the quick reply.

    Have you updated properly?

    Yes, doublechecked.


    Line 428 is actually a null check and the code should be like this:


    Jeah looks exactly like that.
    But im still getting that npe.
    Happened after today's update.


    Ill try a clean build.
    Maybe its caused by one of my custom mods.

    avatar
    Karakan

    Posts : 405
    Join date : 2013-10-04

    Re: null pointer exception

    Post  Karakan on 3rd September 2015, 18:04

    Still getting that Npe.

    Using jre1.8.0.60 / jdk1.8.0_60.

    Did you build it with a different jdk version ?

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: null pointer exception

    Post  DnR on 3rd September 2015, 20:56

    I use the same version.
    I killed a monster about 10 times and no errors occured.
    Could your eclipse possibly be out of date?
    Also, what kind of update was that?
    Could you be more specific of the revisions?
    avatar
    Karakan

    Posts : 405
    Join date : 2013-10-04

    Re: null pointer exception

    Post  Karakan on 4th September 2015, 14:36

    Eclipse Mars Release (4.5.0)

    Java : jdk1.8.0_60 , jre1.8.0.60

    Server/DP rev.: 544


    Ive no clue what could cause this.
    Files are all 1:1 copied from svn.


    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: null pointer exception

    Post  DnR on 4th September 2015, 14:38

    Try and modify the code yourself.
    For instance, use "if (killer.getActingPlayer() != null)" check instead and give me feedback.
    avatar
    Karakan

    Posts : 405
    Join date : 2013-10-04

    Re: null pointer exception

    Post  Karakan on 4th September 2015, 15:05

    Great ! That seems to fixed it.
    No errrors on start up.
    No npe's after killing 30 mobs.

    Big thanks for the help DnR. Wink


    Im wondering why i was the only one with this error.





    Code:
     
            // Notify the Quest Engine of the L2Attackable death if necessary
          try
          {
             L2PcInstance player = null;

             if (killer != null)
                player = killer.getActingPlayer();

             if (player != null)
             {
                    if (getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL) != null)
                    {
                        for (Quest quest : getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL))
                            quest.notifyKill(this, player, killer instanceof L2Summon);
                    }
                }
            }

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: null pointer exception

    Post  DnR on 4th September 2015, 16:53

    I'm wondering that, too.
    Btw, killer null check should not be needed, try doing it just for getActingPlayer().
    If you get errors again, then you are probably using a code where doDie(null) is called.

    Sponsored content

    Re: null pointer exception

    Post  Sponsored content


      Current date/time is 16th August 2017, 18:31