Jump to content

World::loadNode() crash


photo

Recommended Posts

Problem

 

When loading an (invalid) node file with only <materials>/<properties> but no <node> element e.g

 

<?xml version="1.0" encoding="utf-8"?>
<nodes version="1.06">
   <materials>
       <library>data/test.mat</library>
   </materials>
</nodes>

 

World::loadNode(const char *name) crashes when trying to cache NULL node pointer

 

Proposal

 

Addition of NULL node pointer check before trying to cache non-exiting node

 

File world/World.cpp

Node *World::loadNode(const char *name) {
   .....	
   .....
if(node == NULL) {
	Log::error("World::loadNode(): missing node\n");
	return NULL;
   }

   // cache node
   Cache &cache = cached_nodes.append(String(name));
   cache.node = node;
   cache.enabled = node->isEnabled(); // NULL node pointer causes crash 
   ....

Link to comment
×
×
  • Create New...