summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2012-04-18 17:04:10 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-04-21 12:16:32 (GMT)
commit5e89f6fe59216586ee06a3e544b195ac4038bb06 (patch)
tree75cb53e71015b1fe8293030e6422f9a4fae9f511 /Swift
parentab8d948710dae16449cbe25fe6f7c95bfa5cf773 (diff)
downloadswift-5e89f6fe59216586ee06a3e544b195ac4038bb06.zip
swift-5e89f6fe59216586ee06a3e544b195ac4038bb06.tar.bz2
Fix bug crashing Swift when sending non-existent file.
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/FileTransfer/FileTransferOverview.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Swift/Controllers/FileTransfer/FileTransferOverview.cpp b/Swift/Controllers/FileTransfer/FileTransferOverview.cpp
index c3ffc5c..e45c7f2 100644
--- a/Swift/Controllers/FileTransfer/FileTransferOverview.cpp
+++ b/Swift/Controllers/FileTransfer/FileTransferOverview.cpp
@@ -7,6 +7,7 @@
#include "FileTransferOverview.h"
#include <boost/bind.hpp>
+#include <boost/filesystem.hpp>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/FileTransfer/FileTransferManager.h>
@@ -22,10 +23,12 @@ FileTransferOverview::~FileTransferOverview() {
}
void FileTransferOverview::sendFile(const JID& jid, const std::string& filename) {
- FileTransferController* controller = new FileTransferController(jid, filename, fileTransferManager);
- fileTransfers.push_back(controller);
-
- onNewFileTransferController(controller);
+ if (boost::filesystem2::exists(filename) && boost::filesystem2::file_size(filename) > 0) {
+ FileTransferController* controller = new FileTransferController(jid, filename, fileTransferManager);
+ fileTransfers.push_back(controller);
+
+ onNewFileTransferController(controller);
+ }
}
void FileTransferOverview::handleIncomingFileTransfer(IncomingFileTransfer::ref transfer) {