aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Version.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/launcher/Version.cpp b/launcher/Version.cpp
index 0640e6d3..01f513e3 100644
--- a/launcher/Version.cpp
+++ b/launcher/Version.cpp
@@ -75,25 +75,20 @@ void Version::parse()
{
m_sections.clear();
QString currentSection;
+
auto classChange = [](QChar lastChar, QChar currentChar) {
- return ((lastChar.isLetter() && currentChar.isDigit()) || (lastChar.isDigit() && currentChar.isLetter()));
+ return !lastChar.isNull() && ((!lastChar.isDigit() && currentChar.isDigit()) || (lastChar.isDigit() && !currentChar.isDigit()));
};
+
for (int i = 0; i < m_string.size(); ++i) {
const auto& current_char = m_string.at(i);
- if (current_char.isDigit() || current_char.isLetter()) {
- if (i > 0 && classChange(m_string.at(i - 1), current_char)) {
- if (!currentSection.isEmpty()) {
- m_sections.append(Section(currentSection));
- }
- currentSection = "";
- }
- currentSection += current_char;
- } else if (current_char == '.' || current_char == '-' || current_char == '_') {
+ if ((i > 0 && classChange(m_string.at(i - 1), current_char)) || current_char == '.' || current_char == '-' || current_char == '+') {
if (!currentSection.isEmpty()) {
m_sections.append(Section(currentSection));
}
currentSection = "";
}
+ currentSection += current_char;
}
if (!currentSection.isEmpty()) {
m_sections.append(Section(currentSection));