aboutsummaryrefslogtreecommitdiffstats
path: root/src/OpcUaClient.cpp
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-04-01 11:54:12 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-04-01 11:54:12 +0200
commited9025f03aa6fcbf720f4e022f3594c85de0a385 (patch)
treee8ce6b3cd42a74172ba69eb6d9aa6ed31ccde8f8 /src/OpcUaClient.cpp
parentf3beb1624c24012c246d17a40c4e10c1c6b3b5b5 (diff)
downloadBobinkQtOpcUa-ed9025f03aa6fcbf720f4e022f3594c85de0a385.tar.gz
BobinkQtOpcUa-ed9025f03aa6fcbf720f4e022f3594c85de0a385.zip
Check all unchecked return values and guard error pathsHEADmaster
Diffstat (limited to 'src/OpcUaClient.cpp')
-rw-r--r--src/OpcUaClient.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/OpcUaClient.cpp b/src/OpcUaClient.cpp
index d212ab2..8835a08 100644
--- a/src/OpcUaClient.cpp
+++ b/src/OpcUaClient.cpp
@@ -173,7 +173,11 @@ OpcUaClient::connectToServer ()
QStringLiteral ("Invalid server URL: %1").arg (m_serverUrl));
return;
}
- m_client->requestEndpoints (url);
+ if (!m_client->requestEndpoints (url))
+ {
+ emit connectionError (
+ QStringLiteral ("Failed to send endpoint request"));
+ }
}
void
@@ -354,11 +358,14 @@ OpcUaClient::handlePasswordRequired (QString keyFilePath, QString *password,
m_keyPassword.clear ();
emit privateKeyPasswordRequired (keyFilePath, previousTryWasInvalid);
- QEventLoop loop;
- m_keyPassLoop = &loop;
- QTimer::singleShot (30000, &loop, &QEventLoop::quit);
- loop.exec ();
- m_keyPassLoop = nullptr;
+ if (m_keyPassword.isEmpty ())
+ {
+ QEventLoop loop;
+ m_keyPassLoop = &loop;
+ QTimer::singleShot (30000, &loop, &QEventLoop::quit);
+ loop.exec ();
+ m_keyPassLoop = nullptr;
+ }
*password = m_keyPassword;
}
@@ -448,7 +455,8 @@ OpcUaClient::doDiscovery ()
QUrl url (m_discoveryUrl);
if (!url.isValid ())
return;
- m_client->findServers (url);
+ if (!m_client->findServers (url))
+ emit statusMessage (QStringLiteral ("Failed to send discovery request"));
}
void