Jump to content

Need someone to check my work. Getting NPE


WonderfulMang

Recommended Posts

Hello! I'm new to this community, but i'm not new to java and when i realized that i could create a script using java I jumped at the chance.

 

I'm getting an NPE and it crashes(not really, just very slow and unresponsive) OSBOT, i can't even look at the logs as it just fills up with useless messages that tell me I have an NPE.

I would really love to look at the stacktrace and see which lines I need to specifically look at but it's too quick for me.

 

I've been trying to use debug messages and see where the problem is myself.

 

Hopefully someone can take the time to search where the NPE would be.

 

Note that not all values aren't filled as they are not being used yet. 

 

Much appreciated ~WonderfulMang

 

Main.class

HatchetType

TreeType

WoodcuttingState

WoodcuttingStyle

DraynorStyle

 

 

This is all of my current code.

Link to comment
Share on other sites

Didn't go through all of those but from a quick look I can tell you that there's a problem in your WoodcuttingStyle constructor. It takes 3 arguments, an area name, an area and a main instance. You don't store that main object that is passed anywhere even though you created a main field in your class (which remains null) and you are using that later on in your code, which probably generates NPE's.

 

ec900e6d5a.png

 

thats supposed to be 

public WoodcuttingStyle(String areaName, Area bank, Main main) {
        this.areaName = areaName;
        this.bank = bank;
        this.main = main;
    }
  • Like 1
Link to comment
Share on other sites

 

Didn't go through all of those but from a quick look I can tell you that there's a problem in your WoodcuttingStyle constructor. It takes 3 arguments, an area name, an area and a main instance. You don't store that main object that is passed anywhere even though you created a main field in your class (which remains null) and you are using that later on in your code, which probably generates NPE's.

 

ec900e6d5a.png

 

thats supposed to be 

public WoodcuttingStyle(String areaName, Area bank, Main main) {
        this.areaName = areaName;
        this.bank = bank;
        this.main = main;
    }

Nice catch! I suppose I completely missed that on my part. Thank you smile.png

Edit: seems to have fixed my problem. Thank you very much.

Edited by WonderfulMang
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...