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
This commit is contained in:
Dylan Enloe 2017-09-28 00:45:05 -07:00
parent 4f39ce32b9
commit 45a322b6ae

View file

@ -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;
}
}
}