Bug - Fixed NPE when equipping / unequipping familiar equipment to currently restricted familiar

Ryo_Sangnoir

Developer
Staff member
To reproduce: familiar none, then ash equip($item[whatever], $familiar[whatever]). Found while equipping the stillsuit at the start of a run.

Code:
Unexpected error, debug log printed.
class java.lang.NullPointerException: Cannot invoke "net.sourceforge.kolmafia.FamiliarData.setItem(net.sourceforge.kolmafia.AdventureResult)" because "familiar" is null
java.lang.NullPointerException: Cannot invoke "net.sourceforge.kolmafia.FamiliarData.setItem(net.sourceforge.kolmafia.AdventureResult)" because "familiar" is null
    at net.sourceforge.kolmafia.request.FamiliarRequest.equipFamiliar(FamiliarRequest.java:830)
    at net.sourceforge.kolmafia.request.FamiliarRequest.parseResponse(FamiliarRequest.java:527)
    at net.sourceforge.kolmafia.request.FamiliarRequest.processResults(FamiliarRequest.java:371)
    at net.sourceforge.kolmafia.request.GenericRequest.processResponse(GenericRequest.java:2203)
    at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:2109)
    at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:1730)
    at net.sourceforge.kolmafia.request.GenericRequest.externalExecute(GenericRequest.java:1397)
    at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1384)
    at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1137)
    at net.sourceforge.kolmafia.request.FamiliarRequest.run(FamiliarRequest.java:191)
    at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:242)
    at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:207)
    at net.sourceforge.kolmafia.textui.RuntimeLibrary.equip(RuntimeLibrary.java:6592)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at net.sourceforge.kolmafia.textui.parsetree.LibraryFunction.execute(LibraryFunction.java:71)
    at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:113)
    at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:423)
    at net.sourceforge.kolmafia.textui.parsetree.Conditional.execute(Conditional.java:54)
    at net.sourceforge.kolmafia.textui.parsetree.If.execute(If.java:35)
    at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:423)
    at net.sourceforge.kolmafia.textui.parsetree.Conditional.execute(Conditional.java:54)
    at net.sourceforge.kolmafia.textui.parsetree.If.execute(If.java:35)
    at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:423)
    at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:87)
    at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:113)
    at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:423)
    at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:87)
    at net.sourceforge.kolmafia.textui.AshRuntime.executeScope(AshRuntime.java:258)
    at net.sourceforge.kolmafia.textui.AshRuntime.execute(AshRuntime.java:186)
    at net.sourceforge.kolmafia.textui.AshRuntime.execute(AshRuntime.java:179)
    at net.sourceforge.kolmafia.textui.command.CallScriptCommand.call(CallScriptCommand.java:195)
    at net.sourceforge.kolmafia.KoLmafiaCLI.doExecuteCommand(KoLmafiaCLI.java:463)
    at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:419)
    at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:338)
    at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:225)
    at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.handleQueue(CommandDisplayFrame.java:139)
    at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:116)
 

Ryo_Sangnoir

Developer
Staff member
To add to this: it occurs when you equip a currently restricted familiar.

Or when you unequip a restricted familiar in the relay browser:
Code:
java.lang.NullPointerException: Cannot invoke "net.sourceforge.kolmafia.FamiliarData.setItem(net.sourceforge.kolmafia.AdventureResult)" because "familiar" is null
    at net.sourceforge.kolmafia.request.FamiliarRequest.unequipFamiliar(FamiliarRequest.java:834)
    at net.sourceforge.kolmafia.request.FamiliarRequest.parseResponse(FamiliarRequest.java:554)
    at net.sourceforge.kolmafia.session.ResponseTextParser.externalUpdate(ResponseTextParser.java:399)
    at net.sourceforge.kolmafia.session.ResponseTextParser.externalUpdate(ResponseTextParser.java:217)
    at net.sourceforge.kolmafia.request.GenericRequest.processResults(GenericRequest.java:2353)
    at net.sourceforge.kolmafia.request.PasswordHashRequest.processResults(PasswordHashRequest.java:18)
    at net.sourceforge.kolmafia.request.GenericRequest.processResponse(GenericRequest.java:2203)
    at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:2109)
    at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:1730)
    at net.sourceforge.kolmafia.request.GenericRequest.externalExecute(GenericRequest.java:1397)
    at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1384)
    at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1137)
    at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:3495)
    at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:242)
    at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:207)
    at net.sourceforge.kolmafia.webui.RelayAgent.readServerResponse(RelayAgent.java:458)
    at net.sourceforge.kolmafia.webui.RelayAgent.performRelay(RelayAgent.java:103)
    at net.sourceforge.kolmafia.webui.RelayAgent.run(RelayAgent.java:82)
 
Top