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

[1.3.0] stoi error parsing playlist #864

Closed
JasonMarechal25 opened this issue Jul 5, 2024 · 0 comments · Fixed by #879
Closed

[1.3.0] stoi error parsing playlist #864

JasonMarechal25 opened this issue Jul 5, 2024 · 0 comments · Fixed by #879
Labels
bug Something isn't working

Comments

@JasonMarechal25
Copy link
Contributor

In GeneralDataReader.h:GetKeyValFromLine
We parse the section "[playlist]" of generalData.ini

If most values are in the form of "key += Number" one valid entry is "playlist_reset = False"
We use "std::stoi" to convert numbers, however "False" is not a valid representation of a number.

Historically we used std::atoi which does not throw and return 0 in case of error.

std::atoi is useful for playlist_reset entry, but if we have an invalid "key += Number" entry it will silently fail and wrongly set 0 as value for the key.

I think we should handle the exception properly in case Number is invalid and generate meaningful error.
We could however ignore "playlist_reset" line entirely either inside GetKeyValFromLine and return {"", 0} or not call GetKeyValFromLine for playlist_reset line.

Fix should be applied to 1.3.0 release. Check 1.2.x version if bug is present too.

@JasonMarechal25 JasonMarechal25 added the bug Something isn't working label Jul 5, 2024
JasonMarechal25 added a commit that referenced this issue Jul 23, 2024
Fix #864
Properly handle data and avoid exception thrown when reading not
numerical values with stoi when reading "playlist_reset" entry in
general_data.ini

---------

Co-authored-by: Florian Omnès <[email protected]>
(cherry picked from commit caf2805)
JasonMarechal25 added a commit that referenced this issue Jul 23, 2024
Fix #864
Properly handle data and avoid exception thrown when reading not
numerical values with stoi when reading "playlist_reset" entry in
general_data.ini

---------

Co-authored-by: Florian Omnès <[email protected]>

(cherry picked from commit caf2805)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant