From 232613638ff9ad6be867c73f287482790669393c Mon Sep 17 00:00:00 2001 From: Brian McBee Date: Mon, 26 Nov 2007 16:39:00 +0000 Subject: Attempt to handle MYSQL error fetching assets --- OpenSim/Framework/Data.MySQL/MySQLAssetData.cs | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs index aa31d3c..38d0a8f 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs @@ -76,20 +76,27 @@ namespace OpenSim.Framework.Data.MySQL _dbConnection.Connection); MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); p.Value = assetID.GetBytes(); - using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) + try { - if (dbReader.Read()) + using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { - asset = new AssetBase(); - asset.Data = (byte[]) dbReader["data"]; - asset.Description = (string) dbReader["description"]; - asset.FullID = assetID; - asset.InvType = (sbyte) dbReader["invType"]; - asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false; - asset.Name = (string) dbReader["name"]; - asset.Type = (sbyte) dbReader["assetType"]; + if (dbReader.Read()) + { + asset = new AssetBase(); + asset.Data = (byte[])dbReader["data"]; + asset.Description = (string)dbReader["description"]; + asset.FullID = assetID; + asset.InvType = (sbyte)dbReader["invType"]; + asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; + asset.Name = (string)dbReader["name"]; + asset.Type = (sbyte)dbReader["assetType"]; + } } } + catch (Exception) + { + MainLog.Instance.Warn("ASSETS", "MySql failure fetching asset"); + } } return asset; } -- cgit v1.1