summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/range.cpp2
-rw-r--r--scene/gui/tree.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index 9c016b5a50..362697b4ad 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -173,6 +173,8 @@ void Range::set_as_ratio(double p_value) {
}
double Range::get_as_ratio() const {
+ ERR_FAIL_COND_V_MSG(Math::is_equal_approx(get_max(), get_min()), 0.0, "Cannot get ratio when minimum and maximum value are equal.");
+
if (shared->exp_ratio && get_min() >= 0) {
double exp_min = get_min() == 0 ? 0.0 : Math::log(get_min()) / Math::log((double)2);
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 361830173b..d5227f6e65 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -159,7 +159,7 @@ protected:
//bind helpers
Dictionary _get_range_config(int p_column) {
Dictionary d;
- double min, max, step;
+ double min = 0.0, max = 0.0, step = 0.0;
get_range_config(p_column, min, max, step);
d["min"] = min;
d["max"] = max;