mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-19 08:12:07 +08:00
cabana: fix broken message filtering (#28319)
fix message filtering old-commit-hash: b0120e30a491bad0284f860e81064d142519e647
This commit is contained in:
@@ -254,9 +254,13 @@ static bool parseRange(const QString &filter, uint32_t value, int base = 10) {
|
||||
unsigned int min = std::numeric_limits<unsigned int>::min();
|
||||
unsigned int max = std::numeric_limits<unsigned int>::max();
|
||||
auto s = filter.split('-');
|
||||
bool ok = s.size() <= 2;
|
||||
bool ok = s.size() >= 1 && s.size() <= 2;
|
||||
if (ok && !s[0].isEmpty()) min = s[0].toUInt(&ok, base);
|
||||
if (ok && s.size() == 2 && !s[1].isEmpty()) max = s[1].toUInt(&ok, base);
|
||||
if (ok && s.size() == 1) {
|
||||
max = min;
|
||||
} else if (ok && s.size() == 2 && !s[1].isEmpty()) {
|
||||
max = s[1].toUInt(&ok, base);
|
||||
}
|
||||
return ok && value >= min && value <= max;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user