Repair database routines so they properly return null when asked for

the heighmap of a region that does not exist.
0.8.0.3
Robert Adams 2014-01-28 15:29:06 -08:00
parent 8eec717f5f
commit e5d59dc696
5 changed files with 21 additions and 4 deletions

View File

@ -531,10 +531,14 @@ ELSE
/// <returns></returns>
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;

View File

@ -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;

View File

@ -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))

View File

@ -524,10 +524,14 @@ namespace OpenSim.Data.PGSQL
/// <returns></returns>
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;

View File

@ -870,10 +870,14 @@ namespace OpenSim.Data.SQLite
/// <returns>Heightfield data</returns>
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;