diff --git a/src/jamidht/channeled_transfers.cpp b/src/jamidht/channeled_transfers.cpp index c17ca6d994eddc8b04f21e83f57ef91158abd3bc..dd2777c70d983eaa823db0de26f5f6f666d609b5 100644 --- a/src/jamidht/channeled_transfers.cpp +++ b/src/jamidht/channeled_transfers.cpp @@ -38,9 +38,11 @@ ChanneledOutgoingTransfer::ChanneledOutgoingTransfer(const std::shared_ptr<Chann ChanneledOutgoingTransfer::~ChanneledOutgoingTransfer() { channel_->setOnRecv({}); - file_->setOnRecv({}); + if (file_) + file_->setOnRecv({}); channel_->shutdown(); - file_->close(); + if (file_) + file_->close(); } std::string