Thread: Annoying Null Pointer.

Results 1 to 8 of 8
  1. #1 Annoying Null Pointer. 
    Registered Member

    Join Date
    Jan 2008
    Posts
    2,345
    Thanks given
    20
    Thanks received
    575
    Rep Power
    1202
    fixed it
    Reply With Quote  
     

  2. #2  
    Ben121
    Guest
    What code is on line 21?
    Reply With Quote  
     

  3. #3  
    iamgodsent
    Guest
    Code:
    if (p == null || n == null || p.isDead || p.skillLvl[3] <= 0 || n.isDead || n.currentHP <= 0 || p.disconnected[0]) {
    	    resetAttack(p);
            }
    lol if p==null u want to reset the attack for p which == null? smart vry smart
    do somting more liek
    if(p==null || n==null)
    return;
    Reply With Quote  
     

  4. #4  
    Respected Member


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    12,549
    Thanks given
    177
    Thanks received
    5,784
    Discord
    View profile
    Rep Power
    5000
    Quote Originally Posted by Lil_Michael View Post
    Soz for double post, but it still happens.

    Ive made it look like this:

    Code:
            if (n == null || p.isDead || p.skillLvl[3] <= 0 || n.isDead || n.currentHP <= 0 || p.disconnected[0]) {
    	    resetAttack(p);
            }
    if(p == null) {
    return;
    }
    Doesn't help :F
    Because it's trying to reset attack for a null player before checking if the player is null WDF?

    And the npc may be null, or the NPC attack id may be -1, which would cause a nullpointer.

    Reply With Quote  
     

  5. #5  
    iamgodsent
    Guest
    Quote Originally Posted by Lil_Michael View Post
    Alright, Hows this:

    Code:
    if(p == null || p.playerId < 1) {
                    return;
    }
    if (p.attackNPC < 1 || n.npcId < 1 || n == null || p.isDead || p.skillLvl[3] <= 0 || n.isDead || n.currentHP <= 0 || p.disconnected[0]) {
    	    	resetAttack(p);
            }
    Still happens.
    ur looking for a null players index?
    Reply With Quote  
     

  6. #6  
    iamgodsent
    Guest
    Quote Originally Posted by Lil_Michael View Post
    Kewl, now i get a new nllpointer. (:

    Code:
    Exception in thread "Thread-0" java.lang.NullPointerException
    at ploxage.scape.players.combat.PlayerCombat.attackPlayer(PlayerCombat.java:24)
            at ploxage.scape.players.Player.process(Player.java:873)
            at ploxage.scape.Engine.run(Engine.java:77)
            at java.lang.Thread.run(Unknown Source)
    Code:
    	if(p == null) {
    	return;
    	}
            if (p2 == null || p.isDead || p2.isDead || p2.skillLvl[3] <= 0 || p.skillLvl[3] <= 0 || p.disconnected[0] || p2.disconnected[0]) {
    		resetAttack(p);
            }
    Wuts going wrong there lele?
    pastebin the line that err is at
    Reply With Quote  
     

  7. #7  
    Respected Member


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    12,549
    Thanks given
    177
    Thanks received
    5,784
    Discord
    View profile
    Rep Power
    5000
    try posting the actual lines were the error occurs..

    Reply With Quote  
     

  8. #8  
    Respected Member


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    12,549
    Thanks given
    177
    Thanks received
    5,784
    Discord
    View profile
    Rep Power
    5000
    it'll be player 2

    Code:
    int offsetX = -1;
    if (p2 != -1) {
         offsetX = (p.absX - p2.absX) * -1;
    }

    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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •