Jump to content

java.lang.NullPointerException-model.Item.iiIiiiiiIiiI(rk:290)


Pegasus

Recommended Posts

org.osbot.rs07.api.model.Item.iiIiiiiiIiiI(rk:290)
java.util.stream.MatchOps$1MatchSink.accept(Unknown Source)
java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)

Anyone know what code in osbot use java.util.stream.AbstractPipeline.copyIntoWithCancel?

Link to comment
Share on other sites

1 hour ago, Pegasus said:

org.osbot.rs07.api.model.Item.iiIiiiiiIiiI(rk:290)
java.util.stream.MatchOps$1MatchSink.accept(Unknown Source)
java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)

Anyone know what code in osbot use java.util.stream.AbstractPipeline.copyIntoWithCancel?

Might help to see the code or know what you're trying to do with this

Link to comment
Share on other sites

6 minutes ago, Team Cape said:

Might help to see the code or know what you're trying to do with this

thanks, I found out that it is caused  by a filter variable.

 public Filter<Item> jewFilter = (jew) -> {
       return jew.nameContains(this.getAllCharged());
};
   
   this.equipment.isWearingItem(JEW.getEquipmentSlot(), jewFilter))

 

I use this instead which works now

this.equipment.isWearingItem(JEW.getEquipmentSlot(), new NameFilter<Item>(JEW.getAllCharged()))

I am not familiar with filter class now.

 

Edited by Pegasus
Link to comment
Share on other sites

2 hours ago, Pegasus said:

thanks, I found out that it is caused  by a filter variable.


 public Filter<Item> jewFilter = (jew) -> {
       return jew.nameContains(this.getAllCharged());
};
   
   this.equipment.isWearingItem(JEW.getEquipmentSlot(), jewFilter))

 

I use this instead which works now


this.equipment.isWearingItem(JEW.getEquipmentSlot(), new NameFilter<Item>(JEW.getAllCharged()))

I am not familiar with filter class now.

 

My guess is that some of your equipment slots were empty, so the items in there were returning null. You were calling a method on a null object as a result, which gave you the NPE. Filter is very straightforward. If you're not familiar with lambda, I'd recommend looking up what it's shorthand for, and you'll likely understand filters better :) 

Link to comment
Share on other sites

1 hour ago, Team Cape said:

My guess is that some of your equipment slots were empty, so the items in there were returning null. You were calling a method on a null object as a result, which gave you the NPE. Filter is very straightforward. If you're not familiar with lambda, I'd recommend looking up what it's shorthand for, and you'll likely understand filters better :) 

Your guess is correct.

I didn't think about that the filter variable can be null.

It is troublesome that NPE printstacktrace doesn't print the method

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...