Jump to content

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


Recommended Posts

Posted
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?

Posted
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

Posted (edited)
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
Posted
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 :) 

Posted
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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