diff options
Diffstat (limited to 'message.cpp')
-rw-r--r-- | message.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/message.cpp b/message.cpp index 95bc586..33211da 100644 --- a/message.cpp +++ b/message.cpp @@ -29,14 +29,18 @@ Message::Message() bool Message::createRequest(QString api, QString verb, QJsonValue parameter) { - QJsonArray *request = new QJsonArray; - request->append(Call); - request->append(9999); - request->append(api + (QString)("/") + verb); - request->append(QJsonValue(parameter)); + if (!m_request.isEmpty()){ + qWarning("Message instance has already been used. Cannot send another request."); + return false; + } + + m_request.append(Call); + m_request.append(9999); + m_request.append(api + (QString)("/") + verb); + m_request.append(QJsonValue(parameter)); QJsonDocument jdoc; - jdoc.setArray(*request); + jdoc.setArray(m_request); m_jdoc = jdoc; m_init = true; |