Browse Source

Prevents Assert Failures from Depreciated Fields

Peter Robinson 2 years ago
parent
commit
3a81340e41
2 changed files with 8 additions and 2 deletions
  1. 5 1
      engine/source/console/consoleBaseType.cc
  2. 3 1
      engine/source/sim/simObject.cc

+ 5 - 1
engine/source/console/consoleBaseType.cc

@@ -58,7 +58,11 @@ void ConsoleBaseType::initialize()
 
 ConsoleBaseType  *ConsoleBaseType::getType(const S32 typeID)
 {
-   return gConsoleTypeTable[typeID];
+	if(typeID > 0)
+	{
+		return gConsoleTypeTable[typeID];
+	}
+	return NULL;
 }
 //-------------------------------------------------------------------------
 

+ 3 - 1
engine/source/sim/simObject.cc

@@ -813,10 +813,12 @@ StringTableEntry SimObject::getDataFieldPrefix( StringTableEntry fieldName )
     // Return nothing if field was not found.
     if ( pField == NULL )
         return StringTable->EmptyString;
-
     // Yes, so fetch the console base type.
     ConsoleBaseType* pConsoleBaseType = ConsoleBaseType::getType( pField->type );
 
+	if(pConsoleBaseType == NULL)
+		return StringTable->EmptyString;
+
     // Fetch the type prefix.
     return pConsoleBaseType->getTypePrefix();
 }