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 ) ) {
model = InitModel( modelName ); try {
if( model != null ) { model = InitModel( modelName );
cache[modelName] = model; } catch( FileNotFoundException ) {
} else { model = null;
model = cache["humanoid"]; // fallback to default Utils.LogWarning( modelName + " not found, falling back to human default." );
} }
if( model == null )
model = cache["humanoid"]; // fallback to default
cache[modelName] = model;
} }
return model; return model;
} }