diff options
Diffstat (limited to 'src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp')
-rw-r--r-- | src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp index e47bd4d5..1b5a1776 100644 --- a/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp +++ b/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp @@ -94,22 +94,29 @@ void QPlaceContentReplyImpl::setError(QPlaceReply::Error error_, const QString & void QPlaceContentReplyImpl::replyFinished() { - QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); - if (!document.isObject()) { - setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR)); - return; + if (m_reply->isOpen()) { + QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); + if (!document.isObject()) { + setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR)); + return; + } + + QJsonObject object = document.object(); + + QPlaceContent::Collection collection; + int totalCount; + QPlaceContentRequest previous; + QPlaceContentRequest next; + + parseCollection(request().contentType(), object, &collection, &totalCount, + &previous, &next, m_engine); + + setTotalCount(totalCount); + setContent(collection); + setPreviousPageRequest(previous); + setNextPageRequest(next); } - QJsonObject object = document.object(); - - QPlaceContent::Collection collection; - int totalCount; - - parseCollection(request().contentType(), object, &collection, &totalCount, m_engine); - - setTotalCount(totalCount); - setContent(collection); - m_reply->deleteLater(); m_reply = 0; |