From: Victor Grishchenko Date: Mon, 1 Feb 2010 13:08:32 +0000 (+0100) Subject: added a safeguard X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=c681cc7a534588f2b7ad1de1b67a63372ff776ed;p=swift-upb.git added a safeguard --- diff --git a/swift.cpp b/swift.cpp index 6d432c5..ee9f13c 100644 --- a/swift.cpp +++ b/swift.cpp @@ -107,8 +107,7 @@ void swift::Loop (tint till) { int swift::Open (const char* filename, const Sha1Hash& hash) { FileTransfer* ft = new FileTransfer(filename, hash); - int fdes = ft->file().file_descriptor(); - if (fdes>0) { + if (ft && ft->file().file_descriptor()) { /*if (FileTransfer::files.size()file().file_descriptor(); } else { - delete ft; + if (ft) + delete ft; return -1; } } @@ -185,9 +185,6 @@ const Sha1Hash& swift::RootMerkleHash (int file) { (channels are cheap and easily recycled)
  • a datagram must contain either the receiving channel id (scrambled) or the root hash -
  • initially, the control structure (p2tp_channel) - is mostly zeroed; intialization happens as - conversation progresses Note: */