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

Core: Silently fix invalid yaml option for Toggles #3179

Merged
merged 1 commit into from
Apr 21, 2024

Conversation

ScipioWright
Copy link
Collaborator

@ScipioWright ScipioWright commented Apr 19, 2024

What is this fixing or adding?

When the user puts in an invalid option for a Toggle, it fails at the end of gen with a very unhelpful

Traceback (most recent call last):
  File "__startup__.py", line 124, in run
  File "console.py", line 16, in run
  File "Generate.py", line 549, in <module>
  File "Generate.py", line 240, in main
  File "Main.py", line 442, in main
  File "BaseClasses.py", line 1377, in to_file
  File "BaseClasses.py", line 1360, in write_option
  File "Options.py", line 137, in current_option_name
  File "Options.py", line 397, in get_option_name
IndexError: list index out of range

Now, it'll just convert it to something valid.

Ref discussion: https://discord.com/channels/731205301247803413/1224562534753898647

Previous PR: #3098

Easy way to reproduce the error:
Grab a Clique yaml, set the Hard Mode option to 4

How was this tested?

Tested by picking a yaml, setting a Toggle setting to something greater than 1, then seeing it not error out.

If this makes graphical changes, please attach screenshots.

N/A

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Apr 19, 2024
Copy link
Member

@Berserker66 Berserker66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since bool is a subclass of int, that last call isn't stricly necessary, but I think it's fine here to make the intention clear.

@Berserker66 Berserker66 merged commit 442c7d0 into ArchipelagoMW:main Apr 21, 2024
16 checks passed
@Berserker66
Copy link
Member

I do wonder if loudly fail would be better though; time will tell.

@ScipioWright
Copy link
Collaborator Author

Yeah, we'll have to see. I think it should be fine?

@ScipioWright ScipioWright deleted the patch-1 branch April 21, 2024 02:55
qwint pushed a commit to qwint/Archipelago that referenced this pull request Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants