Bug - Fixed $class[none] causes java.lang.NullPointerException

soolar

Member
It took me a bit to narrow this down, but the simplest reproducible example I've found is just

Code:
> ash $class[none]

Returned: none
id => -1
primestat => none
Unexpected error, debug log printed.

The debug log contains

Code:
Unexpected error, debug log printed.
class java.lang.NullPointerException: null
java.lang.NullPointerException

I tested this with every other type I know of ($bounty, $coinmaster, $effect, $element, $familiar, $item, $location, $modifier, $monster, $phylum, $servant, $skill, $slot, $stat, $thrall) and did not run in to this issue.
 

heeheehee

Developer
Staff member
Two relevant pieces:

1.
> ash $class[none]

Returned: none
id => -1
primestat => none
Unexpected error, debug log printed.
(note the absence of "path")

2.
Code:
Unexpected error, debug log printed.
class java.lang.NullPointerException: Cannot invoke "net.sourceforge.kolmafia.textui.AshRuntime.runtimeException(String)" because "interpreter" is null
java.lang.NullPointerException: Cannot invoke "net.sourceforge.kolmafia.textui.AshRuntime.runtimeException(String)" because "interpreter" is null
    at net.sourceforge.kolmafia.textui.parsetree.ProxyRecordValue.aref(ProxyRecordValue.java:85)
    at net.sourceforge.kolmafia.textui.parsetree.ProxyRecordValue.aref(ProxyRecordValue.java:70)
    at net.sourceforge.kolmafia.textui.parsetree.CompositeValue.aref(CompositeValue.java:28)
    at net.sourceforge.kolmafia.textui.RuntimeLibrary.dump(RuntimeLibrary.java:3250)
    at net.sourceforge.kolmafia.textui.RuntimeLibrary.dump(RuntimeLibrary.java:3240)
    at net.sourceforge.kolmafia.textui.command.AshSingleLineCommand.run(AshSingleLineCommand.java:48)
    at net.sourceforge.kolmafia.KoLmafiaCLI.doExecuteCommand(KoLmafiaCLI.java:467)
    at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:433)
    at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:352)
    at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:239)
    at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.handleQueue(CommandDisplayFrame.java:139)
    at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:116)
(stack trace)

At least, assuming that I'm seeing the same problem you are.

As far as I can tell, the NPE is a secondary issue (but not the root cause here).
 

heeheehee

Developer
Staff member
The root cause is that if this.content == null, then this:
Code:
    public Value get_path() {
      return DataTypes.makePathValue(getAscensionClass().getPath());
    }
tries to access getPath() on a null pointer.
 
Top