From d3f0875ed5d620febf2cff1b53c8c1b5a3c7034e Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 21 Mar 2011 08:19:00 +0000 Subject: [PATCH] fixed division by zero --- src/session_impl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 33ec1e869..cdec24565 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -2461,6 +2461,8 @@ namespace aux { conns.push_back(p); } + if (conns.empty()) return; + // pick a random peer to start with, to evenly distribute // the disk bandwidth std::vector::iterator peer = conns.begin() + (rand() % conns.size());