mirror of
https://github.com/opensim/opensim.git
synced 2026-05-14 18:55:39 +08:00
Include code to return more information about the NullReferenceException seen in
http://opensimulator.org/mantis/view.php?id=5403 prior to doing something about it.
This commit is contained in:
@@ -39,6 +39,8 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Dictionary<string, FieldInfo> m_Fields =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
@@ -217,7 +219,6 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
|
||||
string query = "";
|
||||
List<String> names = new List<String>();
|
||||
List<String> values = new List<String>();
|
||||
@@ -226,6 +227,16 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
names.Add(fi.Name);
|
||||
values.Add("?" + fi.Name);
|
||||
|
||||
// Temporarily return more information about what field is unexpectedly null for
|
||||
// http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
|
||||
// InventoryTransferModule or we may be required to substitute a DBNull here.
|
||||
if (fi.GetValue(row) == null)
|
||||
throw new NullReferenceException(
|
||||
string.Format(
|
||||
"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
|
||||
fi.Name, row));
|
||||
|
||||
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
|
||||
}
|
||||
|
||||
@@ -268,4 +279,4 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user