Thread: Error - java.lang.NullPointerException [Reward for fix]

Results 1 to 7 of 7
  1. #1 Error - java.lang.NullPointerException [Reward for fix] 
    Registered Member
    Join Date
    Mar 2013
    Posts
    22
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    I dont have much to say about this error, any help will be accepted - fixing error will mean a reward in paypal money or other way.
    Skype for the Error fix: EyoHawk!
    Error:
    Code:
    [4/24/13 3:27 PM]: java.lang.NullPointerException
    [4/24/13 3:27 PM]:      at server.model.content.KillingStreak.killedPlayer(Killi
    ngStreak.java:76)
    [4/24/13 3:27 PM]:      at server.model.players.PlayerAssistant.applyDead(Player
    Assistant.java:1606)
    [4/24/13 3:27 PM]:      at server.model.players.Client.process(Client.java:1943)
    
    [4/24/13 3:27 PM]:      at server.model.players.PlayerHandler.process(PlayerHand
    ler.java:169)
    [4/24/13 3:27 PM]:      at server.task.impl.ProcessPlayerHandler$1.run(ProcessPl
    ayerHandler.java:15)
    [4/24/13 3:27 PM]:      at server.GameEngine$4.run(GameEngine.java:161)
    [4/24/13 3:27 PM]:      at java.util.concurrent.Executors$RunnableAdapter.call(U
    nknown Source)
    [4/24/13 3:27 PM]:      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
     Source)
    [4/24/13 3:27 PM]:      at java.util.concurrent.FutureTask.run(Unknown Source)
    [4/24/13 3:27 PM]:      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unk
    nown Source)
    [4/24/13 3:27 PM]:      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Un
    known Source)
    [4/24/13 3:27 PM]:      at java.lang.Thread.run(Unknown Source)
    Edit: Peoples is talking about Pk System the pvp reward system you get money for killing somone on a pvp streak - WIll send file if needed or Skype me!
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    May 2011
    Posts
    1,773
    Thanks given
    854
    Thanks received
    853
    Rep Power
    0
    post KillingStreak.java line: 76

    you are probably not checking if the player is null
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Mar 2013
    Posts
    22
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    public void killedPlayer() {
    Client o = (Client) PlayerHandler.players[c.killerId];
    if (o.killStreak >= 2 || c.killerId != o.playerId) {
    yell("[ <col=FF0000>PvP System </col>] <col=FF0000>"+c.playerName+"</col> has ended <col=FF0000>"+o.playerName+" </col>killing streak of <col=FF0000>"+o.killStreak+"</col>, and was rewarded.");
    Rewards();
    }
    }
    }

    Here ya go matie if you want i can paste all off the code

    This is line 76: if (o.killStreak >= 2 || c.killerId != o.playerId) {
    Reply With Quote  
     

  4. #4  
    Donator
    Darkness's Avatar
    Join Date
    Nov 2012
    Age
    26
    Posts
    876
    Thanks given
    121
    Thanks received
    75
    Rep Power
    47
    I don't understand why its " ||" and not "&&" but that probably doesn't cause the error, i had a similar problem in my dieing process once, it used the playerId and killerID thing too, and my friend added a try { and a end bracket and everything worked fine..

    Idk if that can help but it's always some info
    Attached image
    Reply With Quote  
     

  5. #5  
    Registered Member Sakki54's Avatar
    Join Date
    Jul 2010
    Posts
    159
    Thanks given
    37
    Thanks received
    12
    Rep Power
    1
    Quote Originally Posted by EyeHawky View Post
    This is line 76: if (o.killStreak >= 2 || c.killerId != o.playerId) {
    Right above that line add
    Code:
    if(o == null || c == null) return;
    You forgot to check if the client, or his killer, were null. Whenever you create a new client/npc variable always check if they're null before using them.
    Last edited by Sakki54; 04-25-2013 at 02:29 AM. Reason: I'm stupid :/ and added the word "variable" o.0

    Reply With Quote  
     

  6. #6  
    I'm secretly a carrot named 3arl.

    Mainframe's Avatar
    Join Date
    Jun 2012
    Age
    26
    Posts
    1,422
    Thanks given
    542
    Thanks received
    214
    Rep Power
    147
    Quote Originally Posted by Olinice View Post
    I don't understand why its " ||" and not "&&" but that probably doesn't cause the error, i had a similar problem in my dieing process once, it used the playerId and killerID thing too, and my friend added a try { and a end bracket and everything worked fine..

    Idk if that can help but it's always some info
    || means one or both.
    Reply With Quote  
     

  7. #7  
    Donator
    Darkness's Avatar
    Join Date
    Nov 2012
    Age
    26
    Posts
    876
    Thanks given
    121
    Thanks received
    75
    Rep Power
    47
    Quote Originally Posted by KJ View Post
    || means one or both.
    Iknew that ahaha nevermind i was just thinking something else like it absolutely needed to be both in that case
    Attached image
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] + Others Fixing Client Animation Error Java.Lang
    By Melanie Iglesias in forum Snippets
    Replies: 6
    Last Post: 08-29-2012, 05:03 PM
  2. Replies: 20
    Last Post: 07-02-2012, 11:08 PM
  3. Replies: 8
    Last Post: 11-12-2010, 03:16 AM
  4. Replies: 6
    Last Post: 09-10-2009, 06:04 AM
  5. Replies: 8
    Last Post: 05-25-2009, 01:22 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •