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.
0.6.0-stable
lbsa71 2008-07-27 13:59:07 +00:00
parent 1784918034
commit f417a03414
1 changed files with 16 additions and 8 deletions

View File

@ -68,15 +68,23 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
{ {
FileInfo fInfo = new FileInfo(path); FileInfo fInfo = new FileInfo(path);
long numBytes = fInfo.Length; long numBytes = fInfo.Length;
if (fInfo.Exists)
{
FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read); FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read);
byte[] idata = new byte[numBytes]; byte[] idata = new byte[numBytes];
BinaryReader br = new BinaryReader(fStream); BinaryReader br = new BinaryReader(fStream);
idata = br.ReadBytes((int) numBytes); idata = br.ReadBytes((int)numBytes);
br.Close(); br.Close();
fStream.Close(); fStream.Close();
info.Data = idata; info.Data = idata;
//info.loaded=true; //info.loaded=true;
} }
else
{
m_log.ErrorFormat("[ASSETS]: file: [{0}] not found !", path);
}
}
public void ForEachDefaultXmlAsset(Action<AssetBase> action) public void ForEachDefaultXmlAsset(Action<AssetBase> action)
{ {