From c70e85a3271aaa9e6d892240964cb55cbc2960c7 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 23 Apr 2012 18:38:21 +0300 Subject: When reading a region, use null objects to represent NULL fields. Previously NULL fields were converted to an empty string due to the use of ToString(). But if the field was an Int (e.g., "locZ"), then the subsequent attempt to convert an empty string to an int caused an exception. Now the field is null so we don't try to convert it, so there's no exception. --- OpenSim/Data/MySQL/MySQLRegionData.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index c20c392..948cdf3 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -187,7 +187,11 @@ namespace OpenSim.Data.MySQL if (s == "locY") continue; - ret.Data[s] = result[s].ToString(); + object value = result[s]; + if (value is DBNull) + ret.Data[s] = null; + else + ret.Data[s] = result[s].ToString(); } retList.Add(ret); -- cgit v1.1