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

Throw exception instead of segfaulting on attempt to acess ROM data before ROM set. #82

Merged
merged 1 commit into from
Aug 9, 2015
Merged

Throw exception instead of segfaulting on attempt to acess ROM data before ROM set. #82

merged 1 commit into from
Aug 9, 2015

Conversation

DoctorTeeth
Copy link
Contributor

When you try to, for example, get the number of lives left before loading the ROM, the code should now throw a std::runtime_error.

Optionally, you could also write to a log and mention that this has occurred.
Seems superfluous - the user will see the exception.

Optionally, you could move that pointer check into another function to avoid repeating code.
Also seems a little unnecessary at this point, but I can see the merits.

@mgbellemare
Copy link
Contributor

LGTM. Really what should be happening here is ALEInterface should allocate RomSettings & other auxiliary structures within its constructor, so as to avoid the three step process (constructor, set options, loadROM). @mhauskn : we could do this by passing a rom filename + list of options to the ALEInterface constructor. But all of this goes beyond the scope of this PR.

mgbellemare added a commit that referenced this pull request Aug 9, 2015
Throw exception instead of segfaulting on attempt to acess ROM data before ROM set.
@mgbellemare mgbellemare merged commit 3d8423d into Farama-Foundation:master Aug 9, 2015
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

2 participants