Browse Source

resource: fix loading resources from bundles

Fixes: #190
Daniele Bartolini 1 year ago
parent
commit
cfa710e023
2 changed files with 6 additions and 1 deletions
  1. 5 0
      src/resource/resource_loader.h
  2. 1 1
      src/resource/resource_manager.cpp

+ 5 - 0
src/resource/resource_loader.h

@@ -31,6 +31,11 @@ struct ResourceRequest
 	LoadFunction load_function;
 	Allocator *allocator;
 	void *data;
+
+	bool is_spurious()
+	{
+		return data == NULL && allocator == NULL;
+	}
 };
 
 /// Loads resources in a background thread.

+ 1 - 1
src/resource/resource_manager.cpp

@@ -238,7 +238,7 @@ void ResourceManager::complete_requests()
 			} else {
 				++pkg_data.online_sequence_num;
 
-				if (rr.data != NULL && rr.allocator != NULL) {
+				if (!rr.is_spurious()) {
 					// If this is a non-spurious request, add it to the resource map.
 					resource_manager_internal::add_resource(*this
 						, rr.type