summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-04-23 15:00:03 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-04-23 15:00:37 (GMT)
commit00981790bc39e9a0674feec19ffa792329bb077c (patch)
tree1c623b82757c2a50cbc452b2cf85ae974ca79804 /Swiften
parentaed9957d22a4fa2e64df08a0e5ddfdbf309f130a (diff)
downloadswift-00981790bc39e9a0674feec19ffa792329bb077c.zip
swift-00981790bc39e9a0674feec19ffa792329bb077c.tar.bz2
Fixed assertion when SRV weights are all 0.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Network/DomainNameServiceQuery.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Swiften/Network/DomainNameServiceQuery.cpp b/Swiften/Network/DomainNameServiceQuery.cpp
index eb999e0..f7ffecc 100644
--- a/Swiften/Network/DomainNameServiceQuery.cpp
+++ b/Swiften/Network/DomainNameServiceQuery.cpp
@@ -52,7 +52,7 @@ void DomainNameServiceQuery::sortResults(std::vector<DomainNameServiceQuery::Res
if (std::distance(i, next) > 1) {
int weightSum = std::accumulate(i, next, 0, WeightAccumulator());
std::vector<double> probabilities;
- std::transform(i, next, std::back_inserter(probabilities), WeightToProbability(weightSum));
+ std::transform(i, next, std::back_inserter(probabilities), WeightToProbability(weightSum > 0 ? weightSum : 1));
// Shuffling the result array and the probabilities in parallel
for (size_t j = 0; j < probabilities.size(); ++j) {