Fixed exception in client when settings.json managed to refer to a non-existent or corrupt .zip

This commit is contained in:
William Moorehouse 2015-06-17 09:17:26 -04:00
parent f15744b7a2
commit a7d394ef19
2 changed files with 8 additions and 8 deletions

View File

@ -84,21 +84,21 @@ namespace TrueCraft.Client.Rendering
public void AddTexturePack(TexturePack texturePack)
{
if (texturePack == null)
throw new ArgumentException();
return;
var archive = new ZipFile(Path.Combine(TexturePack.TexturePackPath, texturePack.Name));
foreach (var entry in archive.Entries)
// Make sure to 'silence' errors loading custom texture packs;
// they're unimportant as we can just use default textures.
try
{
// Make sure to 'silence' errors loading custom texture packs;
// they're unimportant as we can just use default textures.
try
var archive = new ZipFile(Path.Combine(TexturePack.TexturePackPath, texturePack.Name));
foreach (var entry in archive.Entries)
{
var key = entry.FileName;
using (var stream = entry.OpenReader())
AddTexture(key, Texture2D.FromStream(Device, stream));
}
catch { }
}
catch { return; }
}
/// <summary>

View File

@ -43,7 +43,7 @@ namespace TrueCraft.Core
/// <param name="path"></param>
public static TexturePack FromArchive(string path)
{
if (string.IsNullOrEmpty(path) || !File.Exists(path))
if (string.IsNullOrEmpty(path))
throw new ArgumentException();
string description = Unknown.Description;