Hello could someone help explain this error to me
Code:
java.lang.NullPointerException
at com.rs.game.player.content.Trade.endSession(Trade.java:380)
Code:
public void endSession() {
trader.getInterfaceManager().closeScreenInterface();
trader.getInterfaceManager().closeInventoryInterface();
partner.getInterfaceManager().closeScreenInterface();
partner.getInterfaceManager().closeInventoryInterface();
traderItemsOffered = null;
partnerItemsOffered = null;
trader.setTradeSession(null);
partner.setTradePartner(null);
partner.setTradeSession(null);
trader.setTradePartner(null);
trader.setNextFaceEntity(null);
partner.setNextFaceEntity(null);
}
I understand that it is trying to process something that is nulled but how would I fix it? Thanks
Update: Found what was causing the error in my player.java I have this under closeinterfaces()
Code:
public void closeInterfaces() {
if (getTradeSession() != null && getTradeSession().getPartner() != null)
getTradeSession().tradeFailed();
How come this is throwing me this error?
Update2: Figured it out .. I put the code in the wrong place. Ill post the code here in case someone else has the same issue.
Code:
public void closeInterfaces() {
if (interfaceManager.containsScreenInter())
interfaceManager.closeScreenInterface();
if (interfaceManager.containsInventoryInter())
interfaceManager.closeInventoryInterface();
dialogueManager.finishDialogue();
if (closeInterfacesEvent != null) {
closeInterfacesEvent.run();
closeInterfacesEvent = null;
}
if (getTradeSession() != null && getTradeSession().getPartner() != null)
getTradeSession().tradeFailed();
}
Credits go to grundyboy34