Don't crash if textures for mobs aren't found.

This commit is contained in:
UnknownShadow200 2015-04-21 06:38:07 +10:00
parent 87a61e26e2
commit a3ebaf75e5

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace ClassicalSharp.Model {
@ -20,12 +21,15 @@ namespace ClassicalSharp.Model {
}
if( !cache.TryGetValue( modelName, out model ) ) {
try {
model = InitModel( modelName );
if( model != null ) {
cache[modelName] = model;
} else {
model = cache["humanoid"]; // fallback to default
} catch( FileNotFoundException ) {
model = null;
Utils.LogWarning( modelName + " not found, falling back to human default." );
}
if( model == null )
model = cache["humanoid"]; // fallback to default
cache[modelName] = model;
}
return model;
}