summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/io/resource_loader.cpp3
-rw-r--r--core/io/resource_saver.cpp3
-rw-r--r--core/pool_allocator.cpp4
3 files changed, 6 insertions, 4 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index a29b9d1ddb..35af58ad07 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -940,8 +940,7 @@ bool ResourceLoader::add_custom_resource_format_loader(String script_path) {
ERR_EXPLAIN("Cannot instance script as custom resource loader, expected 'ResourceFormatLoader' inheritance, got: " + String(ibt));
ERR_FAIL_COND_V(obj == NULL, false);
- ResourceFormatLoader *crl = NULL;
- crl = Object::cast_to<ResourceFormatLoader>(obj);
+ ResourceFormatLoader *crl = Object::cast_to<ResourceFormatLoader>(obj);
crl->set_script(s.get_ref_ptr());
ResourceLoader::add_resource_format_loader(crl);
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index e2c1c3402a..369cd93442 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -222,8 +222,7 @@ bool ResourceSaver::add_custom_resource_format_saver(String script_path) {
ERR_EXPLAIN("Cannot instance script as custom resource saver, expected 'ResourceFormatSaver' inheritance, got: " + String(ibt));
ERR_FAIL_COND_V(obj == NULL, false);
- ResourceFormatSaver *crl = NULL;
- crl = Object::cast_to<ResourceFormatSaver>(obj);
+ ResourceFormatSaver *crl = Object::cast_to<ResourceFormatSaver>(obj);
crl->set_script(s.get_ref_ptr());
ResourceSaver::add_resource_format_saver(crl);
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index 9b342ef913..48a30f6702 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -539,6 +539,10 @@ void PoolAllocator::unlock(ID p_mem) {
return;
mt_lock();
Entry *e = get_entry(p_mem);
+ if (!e) {
+ mt_unlock();
+ ERR_FAIL_COND(!e);
+ }
if (e->lock == 0) {
mt_unlock();
ERR_PRINT("e->lock == 0");