mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 22:23:07 +00:00
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
@ -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 New Issue
Block a user