Commit 40c52747 authored by Volker Krause's avatar Volker Krause
Browse files

Protect against possible division by zero

CID 180873
parent b1044571
......@@ -216,6 +216,8 @@ QVariant PropertyRatioSource::data()
int total = 0;
for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it)
total += it.value() + d->baseRatioSet.value(it.key());
if (total <= 0)
return m;
for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it) {
double currentValue = it.value() + d->baseRatioSet.value(it.key());
......
......@@ -132,6 +132,8 @@ QVariant SelectionRatioSource::data()
int total = 0;
for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it)
total += it.value() + d->baseRatioSet.value(it.key());
if (total <= 0)
return m;
for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it) {
double currentValue = it.value() + d->baseRatioSet.value(it.key());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment