Commit 1f4ccf54 authored by Andreas Hartmetz's avatar Andreas Hartmetz
Browse files

Fix spurious assertion failure

I have a wacky device here for which smartctl gives the error:
"/dev/sda: Unknown USB bridge [0x0781:0x5591 (0x100)]"

This returned JSON data is missing some expected entries, which
seems to give an invalid parsing result. In that case, skip it
*before* checking for any consistency with further expectations.
parent f51003f3
......@@ -76,16 +76,16 @@ void SMARTMonitor::onSMARTCtlFinished(const QString &devicePath, const QJsonDocu
}
SMARTData data(document);
if (!devicePath.endsWith(QStringLiteral(".json"))) { // simulation data
Q_ASSERT(devicePath == data.m_device);
}
if (!data.m_valid) {
qCDebug(KDED) << "Invalid SMART data; skipping" << devicePath;
device->deleteLater();
return;
}
if (!devicePath.endsWith(QStringLiteral(".json"))) { // simulation data
Q_ASSERT(devicePath == data.m_device);
}
auto existingIt = std::find_if(m_devices.begin(), m_devices.end(), [&device](Device *existing) {
return *existing == *device;
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment