Bug - Fixed NPE for turns_spent when not logged in

Ezandora

Member
r15900

Steps to reproduce:
Open mafia, but do not log in.
Open menu General>Graphical CLI
Run this command:

Code:
> ash $location[the dire warren].turns_spent
Unable to invoke attribute getter: java.lang.NullPointerException ()

Alternatively:

Code:
> ash $location[the dire warren]

Returned: The Dire Warren
nocombats => false
zone => Mountain
parent => Mountain
parentdesc => Big Mountains
environment => underground
bounty => none
combat_queue =>
noncombat_queue =>
Unexpected error, debug log printed.

The second command results in this stack trace:
Code:
class java.lang.NullPointerException: null
java.lang.NullPointerException
	at net.sourceforge.kolmafia.textui.parsetree.ProxyRecordValue.aref(ProxyRecordValue.java:113)
	at net.sourceforge.kolmafia.textui.parsetree.ProxyRecordValue.aref(ProxyRecordValue.java:93)
	at net.sourceforge.kolmafia.textui.parsetree.CompositeValue.aref(CompositeValue.java:59)
	at net.sourceforge.kolmafia.textui.command.AshSingleLineCommand.dump(AshSingleLineCommand.java:99)
	at net.sourceforge.kolmafia.textui.command.AshSingleLineCommand.run(AshSingleLineCommand.java:90)
	at net.sourceforge.kolmafia.KoLmafiaCLI.doExecuteCommand(KoLmafiaCLI.java:596)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:549)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:450)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:318)
	at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.handleQueue(CommandDisplayFrame.java:187)
	at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:163)

I use this method for testing scripts with a clean slate, which is how this came up. (it halts script execution)
 
Top