aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2013-05-11 16:16:02 +0200
committerMelanie2013-05-11 16:16:02 +0200
commit3f6071ce3a2a8970419186fa7d5715f2af8b53ae (patch)
treeced5f4f15a7d79e14f6ab60c0b37fb3c88399e52 /OpenSim/Region
parentRefactor to get closer to core (diff)
downloadopensim-SC-3f6071ce3a2a8970419186fa7d5715f2af8b53ae.zip
opensim-SC-3f6071ce3a2a8970419186fa7d5715f2af8b53ae.tar.gz
opensim-SC-3f6071ce3a2a8970419186fa7d5715f2af8b53ae.tar.bz2
opensim-SC-3f6071ce3a2a8970419186fa7d5715f2af8b53ae.tar.xz
Guard against trying to access terrain heights out of bounds. Clamp to sim.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainChannel.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
index c0ca48e..b6e0a97 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
@@ -131,7 +131,15 @@ namespace OpenSim.Region.Framework.Scenes
131 131
132 public double this[int x, int y] 132 public double this[int x, int y]
133 { 133 {
134 get { return map[x, y]; } 134 get
135 {
136 if (x < 0) x = 0;
137 if (y < 0) y = 0;
138 if (x >= (int)Constants.RegionSize) x = (int)Constants.RegionSize - 1;
139 if (y >= (int)Constants.RegionSize) y = (int)Constants.RegionSize - 1;
140
141 return map[x, y];
142 }
135 set 143 set
136 { 144 {
137 // Will "fix" terrain hole problems. Although not fantastically. 145 // Will "fix" terrain hole problems. Although not fantastically.