From e5d59dc696e647624047465e0e718f2c65106b3c Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Tue, 28 Jan 2014 15:29:06 -0800
Subject: Repair database routines so they properly return null when asked for
the heighmap of a region that does not exist.
---
OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 6 +++++-
OpenSim/Data/MySQL/MySQLSimulationData.cs | 6 +++++-
OpenSim/Data/Null/NullSimulationData.cs | 1 +
OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 6 +++++-
OpenSim/Data/SQLite/SQLiteSimulationData.cs | 6 +++++-
5 files changed, 21 insertions(+), 4 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index 9f5991b..1a5ecd6 100644
--- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -531,10 +531,14 @@ ELSE
///
public double[,] LoadTerrain(UUID regionID)
{
+ double[,] ret = null;
TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
- return terrData.GetDoubles();
+ if (terrData != null)
+ ret = terrData.GetDoubles();
+ return ret;
}
+ // Returns 'null' if region not found
public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
{
TerrainData terrData = null;
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 42f2ebb..2921c1c 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -616,10 +616,14 @@ namespace OpenSim.Data.MySQL
// Legacy region loading
public double[,] LoadTerrain(UUID regionID)
{
+ double[,] ret = null;
TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
- return terrData.GetDoubles();
+ if (terrData != null)
+ ret = terrData.GetDoubles();
+ return ret;
}
+ // Returns 'null' if region not found
public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
{
TerrainData terrData = null;
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs
index acde1a1..deeaced 100644
--- a/OpenSim/Data/Null/NullSimulationData.cs
+++ b/OpenSim/Data/Null/NullSimulationData.cs
@@ -148,6 +148,7 @@ namespace OpenSim.Data.Null
}
// Legacy. Just don't do this.
+ // Returns 'null' if region not found
public double[,] LoadTerrain(UUID regionID)
{
if (m_terrains.ContainsKey(regionID))
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
index 1505f87..77d87d4 100644
--- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
@@ -524,10 +524,14 @@ namespace OpenSim.Data.PGSQL
///
public double[,] LoadTerrain(UUID regionID)
{
+ double[,] ret = null;
TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
- return terrData.GetDoubles();
+ if (terrData != null)
+ ret = terrData.GetDoubles();
+ return ret;
}
+ // Returns 'null' if region not found
public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
{
TerrainData terrData = null;
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 5a34f09..9466e99 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -870,10 +870,14 @@ namespace OpenSim.Data.SQLite
/// Heightfield data
public double[,] LoadTerrain(UUID regionID)
{
+ double[,] ret = null;
TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
- return terrData.GetDoubles();
+ if (terrData != null)
+ ret = terrData.GetDoubles();
+ return ret;
}
+ // Returns 'null' if region not found
public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
{
TerrainData terrData = null;
--
cgit v1.1