From f417a034140b3c66271a3953c6b6355b54d663f4 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 27 Jul 2008 13:59:07 +0000 Subject: Mantis#1817. Thank you kindly, sacha magne, for a patch that: * Fixes a simulator crash when an asset file is missing on loading asset library. --- .../Filesystem/AssetLoaderFileSystem.cs | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework/AssetLoader/Filesystem') diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index ba23d82..7f0e2d6 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs @@ -68,14 +68,22 @@ namespace OpenSim.Framework.AssetLoader.Filesystem { FileInfo fInfo = new FileInfo(path); long numBytes = fInfo.Length; - FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read); - byte[] idata = new byte[numBytes]; - BinaryReader br = new BinaryReader(fStream); - idata = br.ReadBytes((int) numBytes); - br.Close(); - fStream.Close(); - info.Data = idata; - //info.loaded=true; + if (fInfo.Exists) + { + + FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read); + byte[] idata = new byte[numBytes]; + BinaryReader br = new BinaryReader(fStream); + idata = br.ReadBytes((int)numBytes); + br.Close(); + fStream.Close(); + info.Data = idata; + //info.loaded=true; + } + else + { + m_log.ErrorFormat("[ASSETS]: file: [{0}] not found !", path); + } } public void ForEachDefaultXmlAsset(Action action) -- cgit v1.1