diff options
author | José Bollo <jose.bollo@iot.bzh> | 2019-06-13 16:12:22 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2019-06-13 16:12:22 +0200 |
commit | 547374849a76225b1a6a0dd8bb84ae27a601f19d (patch) | |
tree | c2def8dc16fc13c7ed24c937a42a707c8a0a86e2 | |
parent | 886b1208a88e33030e462afcca3b535a9bac5cd9 (diff) |
QAfbWebsocketClient: Allows null callback (FIX)halibut_8.0.2halibut_8.0.1halibut_8.0.0halibut_7.99.3halibut_7.99.2halibut/8.0.2halibut/8.0.1halibut/8.0.0halibut/7.99.3halibut/7.99.28.0.28.0.18.0.07.99.37.99.2
Don't passing a callback is a valid model.
But the library should not crash in that case.
This fix the uissue.
Bug-AGL: SPEC-2520
Change-Id: I6e6f3e6b617cfcf251ac910db5fa27832c2713a1
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | qafbwebsocketclient.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/qafbwebsocketclient.cpp b/qafbwebsocketclient.cpp index 0cbc274..c0e5e71 100644 --- a/qafbwebsocketclient.cpp +++ b/qafbwebsocketclient.cpp @@ -85,8 +85,9 @@ void QAfbWebsocketClient::close() */ void QAfbWebsocketClient::call(const QString& api, const QString& verb, const QJsonValue& arg, closure_t closure) { - QString callId = QString::number(m_nextCallId); - m_closures[callId] = closure; + QString callId = QString::number(m_nextCallId++); + if (closure) + m_closures[callId] = closure; QJsonArray msg; msg.append(2); // Call @@ -94,8 +95,6 @@ void QAfbWebsocketClient::call(const QString& api, const QString& verb, const QJ msg.append(api + "/" + verb); msg.append(arg); - m_nextCallId++; - QJsonDocument value; value.setArray(msg); |