Commit c91dc4b5 authored by Benjamin REIS's avatar Benjamin REIS
Browse files

fix crash in file transfer

parent c865794c
...@@ -538,13 +538,17 @@ void ChatMessagePrivate::send () { ...@@ -538,13 +538,17 @@ void ChatMessagePrivate::send () {
} else } else
msgOp->send_message(ContentType::PlainText.asString().c_str(), internalContent.getBodyAsString().c_str()); msgOp->send_message(ContentType::PlainText.asString().c_str(), internalContent.getBodyAsString().c_str());
for (Content *content : contents) { // Restore FileContents and remove FileTransferContents
// Restore FileContents and remove FileTransferContents list<Content*>::iterator i = contents.begin();
while (i != contents.end()) {
Content *content = *i;
if (content->getContentType() == ContentType::FileTransfer) { if (content->getContentType() == ContentType::FileTransfer) {
FileTransferContent *fileTransferContent = (FileTransferContent *)content; FileTransferContent *fileTransferContent = (FileTransferContent *)content;
q->removeContent(*content); contents.erase(i++);
q->addContent(*fileTransferContent->getFileContent()); q->addContent(*fileTransferContent->getFileContent());
delete fileTransferContent; delete fileTransferContent;
} else {
++i;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment