Fix crash in `syncthingctl cat` after f5795d45c2

This commit is contained in:
Martchus 2023-09-18 22:05:25 +02:00
parent 68858fe702
commit 978636b5aa
1 changed files with 5 additions and 3 deletions

View File

@ -712,9 +712,11 @@ void SyncthingConnection::readDevs(const QJsonArray &devs)
auto newDevs = std::vector<SyncthingDev>();
newDevs.reserve(static_cast<std::size_t>(devs.size()));
auto *const thisDevice = addDevInfo(newDevs, m_myId);
thisDevice->id = m_myId;
thisDevice->status = SyncthingDevStatus::ThisDevice;
thisDevice->paused = false;
if (thisDevice) { // m_myId might be empty, then thisDevice will be nullptr
thisDevice->id = m_myId;
thisDevice->status = SyncthingDevStatus::ThisDevice;
thisDevice->paused = false;
}
for (const auto &devVal : devs) {
const auto devObj = devVal.toObject();