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:
parent
4f39ce32b9
commit
45a322b6ae
1 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue