diff options
author | Dylan Enloe <enloed@gmail.com> | 2017-09-28 00:45:05 -0700 |
---|---|---|
committer | Dylan Enloe <enloed@gmail.com> | 2017-09-28 00:45:05 -0700 |
commit | 45a322b6ae945c6a31e9c1744f24f8776edf4a68 (patch) | |
tree | 558726c5fb9c7cf7cfa348a5f00179a813f58ece | |
parent | 4f39ce32b9195405f934445b20059e86632b47f9 (diff) |
Fix crash when unsharing a range that is not shared
Added a guard to Range::_unref_shared to prevent it from doing anything
in the event that shared is null.
Fixes Issue: #11521
-rw-r--r-- | scene/gui/range.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 1dbec6e5a1..f8fb786fa7 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -208,10 +208,12 @@ void Range::_ref_shared(Shared *p_shared) { void Range::_unref_shared() { - shared->owners.erase(this); - if (shared->owners.size() == 0) { - memdelete(shared); - shared = NULL; + if (shared) { + shared->owners.erase(this); + if (shared->owners.size() == 0) { + memdelete(shared); + shared = NULL; + } } } |