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

Fixed Present Menu Crash #17

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

notexplosive
Copy link
Contributor

In a PRESENT event (eg: PRESENT EVIDENCE SWITCH) we for some reason search both the Evidence and the Profiles tables (maybe that's intentional idk). We index into the Profile table with a P index and into the Evidence table with an E index. The problem is we look into the table we're currently in with both the P and E indices. This is fine for most cases but if you have (for example) 8 evidence items but only 6 profiles you can:

  • Navigate to the 8th evidence item
  • Press "down" to go to the profile menu
  • Attempt to select any profile
  • Crash!!

This is because we looked into the profile table at index P (where we are currently navigated) and index E (where we used to be navigated to in the Evidence menu). E is larger than the size of the table so we get a nil and all hell breaks loose.

One option would be to defensively check if the resulting value is non-nil in each case but that's like 5 places.

Alternatively (aka the fix I actually did), we could just reset both the P and E values to 1 when you toggle between menus. As far as I can tell this is already the observed behavior the game anyway, so we're not doing anything unexpected.

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

Successfully merging this pull request may close these issues.

None yet

1 participant