diff --git a/src/musikcore/library/track/IndexerTrack.cpp b/src/musikcore/library/track/IndexerTrack.cpp index b9fdc4b27..e6a91a122 100644 --- a/src/musikcore/library/track/IndexerTrack.cpp +++ b/src/musikcore/library/track/IndexerTrack.cpp @@ -304,11 +304,13 @@ bool IndexerTrack::NeedsToBeIndexed( static int stringToInt(const std::string& str, const int defaultValue) { try { - return std::stoi(str, 0, 10); + if (str.size()) { + return std::stoi(str, 0, 10); + } } catch (...) { - return defaultValue; } + return defaultValue; } static int64_t writeToTracksTable( diff --git a/src/plugins/taglib_plugin/TaglibMetadataReader.cpp b/src/plugins/taglib_plugin/TaglibMetadataReader.cpp index cc8572352..f9f348aba 100644 --- a/src/plugins/taglib_plugin/TaglibMetadataReader.cpp +++ b/src/plugins/taglib_plugin/TaglibMetadataReader.cpp @@ -146,7 +146,12 @@ static TagLib::FileRef resolveOggType(const char* uri) { } static bool isValidYear(const std::string& year) { - return std::stoi(year) > 0; + try { + return year.size() && std::stoi(year) > 0; + } + catch (...) { + } + return false; } static float toReplayGainFloat(const std::string& input) {