1
0
mirror of synced 2025-01-11 05:42:15 +01:00

fix: Exception being thrown when getting version parts from invalid version

This commit is contained in:
WerWolv 2024-12-28 11:44:51 +01:00
parent 0db0bc53fa
commit 528a8b5b46

View File

@ -39,15 +39,27 @@ namespace hex {
} }
u32 SemanticVersion::major() const { u32 SemanticVersion::major() const {
try {
return std::stoul(m_parts[0]); return std::stoul(m_parts[0]);
} catch (...) {
return 0;
}
} }
u32 SemanticVersion::minor() const { u32 SemanticVersion::minor() const {
try {
return std::stoul(m_parts[1]); return std::stoul(m_parts[1]);
} catch (...) {
return 0;
}
} }
u32 SemanticVersion::patch() const { u32 SemanticVersion::patch() const {
try {
return std::stoul(m_parts[2]); return std::stoul(m_parts[2]);
} catch (...) {
return 0;
}
} }
bool SemanticVersion::nightly() const { bool SemanticVersion::nightly() const {