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

avoid exceptions #828

Merged
merged 2 commits into from Apr 24, 2020
Merged

avoid exceptions #828

merged 2 commits into from Apr 24, 2020

Conversation

KarlStraussberger
Copy link
Member

replaced more std::stoi by stoi_string to avoid exception when reading unformatted data. May be a bit slower but is much safer

replaced more std::stoi by stoi_string to avoid exception when reading unformatted data
@whyman
Copy link
Member

whyman commented Apr 24, 2020

I think I prefer this to just blow up. The DB schema should enforce good data and if not then we probably can't handle that case anyway...

@KarlStraussberger
Copy link
Member Author

I encountered a crash with malformed track numbers. So we should at least handle track number safely and implement try-catch-blocks on the outer levels (search, browse, import) for proper logging of errors.

@whyman
Copy link
Member

whyman commented Apr 24, 2020

Perhaps we should include the setTrackNumber change as the data is externally sourced, but the IDs are internal, so should be safe...

Only check format of tracknumber
@whyman whyman merged commit 203fd12 into gerbera:master Apr 24, 2020
@KarlStraussberger KarlStraussberger deleted the patch-5 branch April 29, 2020 10:10
whorfin pushed a commit to whorfin/gerbera that referenced this pull request May 26, 2020
* avoid exceptions

replaced more std::stoi by stoi_string to avoid exception when reading unformatted data

* Update sql_storage.cc

Only check format of tracknumber
whorfin pushed a commit to whorfin/gerbera that referenced this pull request May 26, 2020
* avoid exceptions

replaced more std::stoi by stoi_string to avoid exception when reading unformatted data

* Update sql_storage.cc

Only check format of tracknumber
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