summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoommetee Ketson <poommetee@protonmail.com>2017-10-02 23:48:59 +0700
committerGitHub <noreply@github.com>2017-10-02 23:48:59 +0700
commitc96fc380e5f6bd6a24a3c4a736eada7a0284975a (patch)
tree8a23b2e87361c1af45cae3841e9b92b15ee2fda1
parentef643690c32c919fd607079107d654e622a57749 (diff)
parent45a322b6ae945c6a31e9c1744f24f8776edf4a68 (diff)
Merge pull request #11650 from kitsune/fix-range-unshare-crash
Fix crash when unsharing a range that is not shared
-rw-r--r--scene/gui/range.cpp10
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;
+ }
}
}