summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-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;
+ }
}
}