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