2
0
Эх сурвалжийг харах

resource: do not reload resources not yet loaded

Daniele Bartolini 5 жил өмнө
parent
commit
174c4df5dc

+ 1 - 0
docs/changelog.rst

@@ -8,6 +8,7 @@ Changelog
 **Runtime**
 
 * Core primitives now include UV, tangent and bitangent data
+* Fixed a crash when reloading lua scripts that haden't been loaded previously
 * Fixed an issue that caused levels to be compiled successfully even when the units they depended on contained errors
 * The Data Compiler now detects when files are deleted
 

+ 3 - 0
src/resource/resource_manager.cpp

@@ -122,6 +122,9 @@ void ResourceManager::reload(StringId64 type, StringId64 name)
 	const ResourceEntry& entry = hash_map::get(_rm, id, ResourceEntry::NOT_FOUND);
 	const u32 old_refs = entry.references;
 
+	if (entry == ResourceEntry::NOT_FOUND)
+		return;
+
 	unload(type, name);
 	load(type, name);
 	flush();