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

Don't try to get non-existent spellbook spells #73800

Merged

Conversation

RenechCDDA
Copy link
Member

Summary

None

Purpose of change

Describe the solution

Don't bother accessing the player's spellbook or knowledge - just get the corresponding spell itself and return the translated name.

Add an additional bit of safety to known_magic::get_spell. It was returning a spell reference even if the reference was known to be bad. Return some dummy data instead. Trying to access the spellbook(std::map) that doesn't contain that requested key inserts that key into the map.

Describe alternatives you've considered

Testing

image

Additional context

@github-actions github-actions bot requested a review from KorGgenT May 15, 2024 09:35
@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels May 15, 2024
@RenechCDDA RenechCDDA force-pushed the dont_get_nonexistent_spellbook_spell branch from c535854 to 7d3394b Compare May 15, 2024 09:38
@Sofistico
Copy link
Contributor

Thx for the catch! I was the one who did the name in the casting waity thingy.

@RenechCDDA RenechCDDA force-pushed the dont_get_nonexistent_spellbook_spell branch from 7d3394b to 569604a Compare May 19, 2024 12:42
@RenechCDDA RenechCDDA force-pushed the dont_get_nonexistent_spellbook_spell branch from 569604a to 85c25ae Compare May 19, 2024 13:00
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label May 19, 2024
@Maleclypse Maleclypse merged commit 02d325a into CleverRaven:master May 20, 2024
19 of 26 checks passed
@RenechCDDA RenechCDDA deleted the dont_get_nonexistent_spellbook_spell branch May 20, 2024 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using the structural imager makes you learn an invalid spell that causes a segfault when cast.
3 participants