Fixed exception in client when settings.json managed to refer to a non-existent or corrupt .zip
This commit is contained in:
parent
f15744b7a2
commit
a7d394ef19
@ -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>
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user