Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stats command is bugged #92

Closed
avaloni opened this issue Sep 29, 2014 · 5 comments
Closed

stats command is bugged #92

avaloni opened this issue Sep 29, 2014 · 5 comments
Labels

Comments

@avaloni
Copy link

avaloni commented Sep 29, 2014

When using the stats command (on the DebugPrompt) it throws a NullPointerException, here is the stack trace.

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.jadventure.game.prompts.CommandParser.parse(CommandParser.java:60)
at com.jadventure.game.Game.gamePrompt(Game.java:68)
at com.jadventure.game.Game.(Game.java:35)
at com.jadventure.game.menus.MainMenu.testOption(MainMenu.java:94)
at com.jadventure.game.menus.MainMenu.start(MainMenu.java:46)
at com.jadventure.game.menus.MainMenu.(MainMenu.java:31)
at com.jadventure.game.JAdventure.main(JAdventure.java:47)
Caused by: java.lang.NullPointerException
at com.jadventure.game.entities.Player.getStats(Player.java:168)
at com.jadventure.game.prompts.DebugPrompt.parse(DebugPrompt.java:77)
at com.jadventure.game.prompts.DebugPrompt.(DebugPrompt.java:30)
at com.jadventure.game.prompts.CommandCollection.command_debug(CommandCollection.java:107)
... 11 more

@projectdelphai
Copy link
Member

Could you give some more info on how to reproduce this bug? Here's my results:

Distro: Arch Linux
Platform: x86-64
Repo: progether:master up-to-date
Steps:

  1. ant run
  2. start new player, recruit, name: "s"
  3. debug
  4. stats

output: expected output (player name,stats)

@avaloni
Copy link
Author

avaloni commented Sep 29, 2014

Huh...it seems inconsistent, must be something to do with my system.

Linux Mint x86-64 with up-to-date master.

  1. Run the game
  2. Create character, recruit, named it "s" to keep consistency
  3. debug
  4. stats

Output as expected, now the following steps:

  1. Exit debug
  2. Save game
  3. Exit to main menu
  4. Exit game
  5. Run game again (ant run)
  6. Load character named "s"
  7. debug
  8. stats

Output: NullPointerException

I kinda found something while debugging this now, when I opened up the game the second time, it didn't load the player information (attributes,name etc) in the player singleton, the attributes are all "inherited", so it throws this error inside Player.getStats() when the program tries to recover the name with getName(). It somehow never initializes the player instance. I'm looking into this, but I'm trying to make sure this happens with other people.

@projectdelphai
Copy link
Member

see if it happens with the test player too

@avaloni
Copy link
Author

avaloni commented Sep 29, 2014

yeah, it happens with "test" too

@paddatrapper
Copy link
Contributor

@avaloni did your fix work or is this still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants