From 978636b5aaf3c279a4a36f1e3ce37fbbd8db5c29 Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 18 Sep 2023 22:05:25 +0200 Subject: [PATCH] Fix crash in `syncthingctl cat` after f5795d45c2d7b1ad04dde9524c6c610f7f --- syncthingconnector/syncthingconnection_requests.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/syncthingconnector/syncthingconnection_requests.cpp b/syncthingconnector/syncthingconnection_requests.cpp index 4ff963c..bbfc1e3 100644 --- a/syncthingconnector/syncthingconnection_requests.cpp +++ b/syncthingconnector/syncthingconnection_requests.cpp @@ -712,9 +712,11 @@ void SyncthingConnection::readDevs(const QJsonArray &devs) auto newDevs = std::vector(); newDevs.reserve(static_cast(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();