aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeng Xuetian <[email protected]>2015-09-27 12:19:00 -0700
committerWeng Xuetian <[email protected]>2015-09-27 12:19:00 -0700
commit8391392149ecae53fa4b792d9e7f06b1a23a8f9f (patch)
tree9f54afd232e298df4b1da16f8fc461d32dc246fe
parenta07ab57eb346986f38525c3f9ad1e378717d3c11 (diff)
Check response content size before accessing it in search job
REVIEW: 125426 CCBUG: 351850
-rw-r--r--src/searchjob.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/searchjob.cpp b/src/searchjob.cpp
index 93cbfb2..382e90b 100644
--- a/src/searchjob.cpp
+++ b/src/searchjob.cpp
@@ -412,14 +412,14 @@ void SearchJob::handleResponse(const Message &response)
Q_D(SearchJob);
if (handleErrorReplies(response) == NotHandled) {
- if (response.content[0].toString() == "+") {
+ if (response.content.size() >= 1 && response.content[0].toString() == "+") {
if (d->term.isNull()) {
d->sessionInternal()->sendData(d->contents[d->nextContent]);
} else {
qCWarning(KIMAP_LOG) << "The term API only supports inline strings.";
}
d->nextContent++;
- } else if (response.content[1].toString() == "SEARCH") {
+ } else if (response.content.size() >= 2 && response.content[1].toString() == "SEARCH") {
for (int i = 2; i < response.content.size(); i++) {
d->results.append(response.content[i].toString().toInt());
}