regularshiz Posted June 17, 2020 Share Posted June 17, 2020 case TRADE: Player muler = getPlayers().closest(player -> player != null && player.getName().equals(mule)); if (!trade.isCurrentlyTrading()) { state = "Trading with mule."; muler.interact("Trade with"); new org.osbot.rs07.utility.ConditionalSleep(20000) { @Override public boolean condition() throws InterruptedException { return trade.isCurrentlyTrading(); } }.sleep(); } why getting null pointer exception for this? Quote Link to comment Share on other sites More sharing options...
ExtraBotz Posted June 17, 2020 Share Posted June 17, 2020 You should still do a null check for the muler object. if(muler != null) { // then we can access the muler object } Also when you use an Interactable the method returns a boolean so you should check if your .interact() interaction returns true. Player muler = getPlayers().closest(player -> player != null && player.getName().equals(mule)); if(muler != null) { if(!trade.isCurrentlyTrading()) { if(muler.interact("Trade with")) { state = "Trading with mule."; // sleep condition } } } 1 Quote Link to comment Share on other sites More sharing options...