Fix #11137: assertion failure due to interpreting string as number #11138
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
Fixed #11137.
When searching for a setting only the first global string parameter is set with STR_EMPTY and then the string is resolved. However, there are two strings that, using
{P 0:2 "" s}
, attempt to access the second global string parameter. When that second global string parameter was last set as a string, then the assertion trigger that it attempts to interpret a string as a number.Description
There is a
STR_CONFIG_SETTING_ERRMSG_DURATION_VALUE
which already has essentially the same content as what would be needed for the value for the two other settings. So rename it to a more genericSTR_CONFIG_SETTING_SECONDS_VALUE
and use that for the three settings that specifically mention a number of seconds in their setting, and remove the unit of seconds from the setting description.Since it is the settingn description string that (also) refers to the second global string parameter, just solving it in english.txt will mean the bug can still be triggered for other languages. As such there is a second patch that removes those strings from the translations, as in this case an outdated string is worse than an untranslated string.
Limitations
There could be other instances of similar assertions. They were added to figure out such inconsistent use, and it seems to have worked. With release builds it will just return 0 instead of assert though.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.