diff options
author | UbitUmarov | 2019-07-15 22:10:47 +0100 |
---|---|---|
committer | UbitUmarov | 2019-07-15 22:10:47 +0100 |
commit | 78359c108dfbecc9d8b7a26712eed061c1c0d648 (patch) | |
tree | 4944ed9536268fec0eead3bcf09d9ff3911e90df /OpenSim/Region/ScriptEngine/Shared | |
parent | When using FSAssets, the HGAssetService would still use AssetService. (diff) | |
download | opensim-SC-78359c108dfbecc9d8b7a26712eed061c1c0d648.zip opensim-SC-78359c108dfbecc9d8b7a26712eed061c1c0d648.tar.gz opensim-SC-78359c108dfbecc9d8b7a26712eed061c1c0d648.tar.bz2 opensim-SC-78359c108dfbecc9d8b7a26712eed061c1c0d648.tar.xz |
mantis 8563: do not modify collection inside a loop on it a foreach on it
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5c04659..5d72858 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -14192,15 +14192,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14192 | { | 14192 | { |
14193 | m_host.AddScriptLPS(1); | 14193 | m_host.AddScriptLPS(1); |
14194 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; | 14194 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; |
14195 | if (land.OwnerID == m_host.OwnerID) | 14195 | if (land.OwnerID == m_host.OwnerID && land.ParcelAccessList.Count > 0) |
14196 | { | 14196 | { |
14197 | var todelete = new List<LandAccessEntry>(); | ||
14197 | foreach (LandAccessEntry entry in land.ParcelAccessList) | 14198 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
14198 | { | 14199 | { |
14199 | if (entry.Flags == AccessList.Ban) | 14200 | if (entry.Flags == AccessList.Ban) |
14200 | { | 14201 | todelete.Add(entry); |
14201 | land.ParcelAccessList.Remove(entry); | ||
14202 | } | ||
14203 | } | 14202 | } |
14203 | foreach (LandAccessEntry entry in todelete) | ||
14204 | land.ParcelAccessList.Remove(entry); | ||
14204 | } | 14205 | } |
14205 | ScriptSleep(m_sleepMsOnResetLandBanList); | 14206 | ScriptSleep(m_sleepMsOnResetLandBanList); |
14206 | } | 14207 | } |
@@ -14209,15 +14210,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14209 | { | 14210 | { |
14210 | m_host.AddScriptLPS(1); | 14211 | m_host.AddScriptLPS(1); |
14211 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; | 14212 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; |
14212 | if (land.OwnerID == m_host.OwnerID) | 14213 | if (land.OwnerID == m_host.OwnerID && land.ParcelAccessList.Count > 0) |
14213 | { | 14214 | { |
14215 | var todelete = new List<LandAccessEntry>(); | ||
14214 | foreach (LandAccessEntry entry in land.ParcelAccessList) | 14216 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
14215 | { | 14217 | { |
14216 | if (entry.Flags == AccessList.Access) | 14218 | if (entry.Flags == AccessList.Access) |
14217 | { | 14219 | todelete.Add(entry); |
14218 | land.ParcelAccessList.Remove(entry); | ||
14219 | } | ||
14220 | } | 14220 | } |
14221 | foreach (LandAccessEntry entry in todelete) | ||
14222 | land.ParcelAccessList.Remove(entry); | ||
14221 | } | 14223 | } |
14222 | ScriptSleep(m_sleepMsOnResetLandPassList); | 14224 | ScriptSleep(m_sleepMsOnResetLandPassList); |
14223 | } | 14225 | } |