diff options
author | UbitUmarov | 2016-08-24 02:00:50 +0100 |
---|---|---|
committer | UbitUmarov | 2016-08-24 02:00:50 +0100 |
commit | fdea8fc96bb68445773c008dab401f7ae49a5534 (patch) | |
tree | 01719158c2503c3ce6d8dfdae4da65b36c01d6ac /OpenSim/Region/CoreModules/Framework | |
parent | potencial null ref (diff) | |
download | opensim-SC-fdea8fc96bb68445773c008dab401f7ae49a5534.zip opensim-SC-fdea8fc96bb68445773c008dab401f7ae49a5534.tar.gz opensim-SC-fdea8fc96bb68445773c008dab401f7ae49a5534.tar.bz2 opensim-SC-fdea8fc96bb68445773c008dab401f7ae49a5534.tar.xz |
potencial null ref
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 76 |
1 files changed, 36 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 00e2670..fa7803f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -261,64 +261,60 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
261 | { | 261 | { |
262 | InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); | 262 | InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); |
263 | 263 | ||
264 | if (item == null) | ||
265 | { | ||
266 | m_log.ErrorFormat( | ||
267 | "[INVENTORY ACCESS MODULE]: Could not find item {0} for caps inventory update", itemID); | ||
268 | return UUID.Zero; | ||
269 | } | ||
270 | |||
264 | if (item.Owner != remoteClient.AgentId) | 271 | if (item.Owner != remoteClient.AgentId) |
265 | return UUID.Zero; | 272 | return UUID.Zero; |
266 | 273 | ||
267 | if (item != null) | 274 | if ((InventoryType)item.InvType == InventoryType.Notecard) |
268 | { | 275 | { |
269 | if ((InventoryType)item.InvType == InventoryType.Notecard) | 276 | if (!m_Scene.Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) |
270 | { | 277 | { |
271 | if (!m_Scene.Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) | 278 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); |
272 | { | 279 | return UUID.Zero; |
273 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); | ||
274 | return UUID.Zero; | ||
275 | } | ||
276 | |||
277 | remoteClient.SendAlertMessage("Notecard saved"); | ||
278 | } | 280 | } |
279 | else if ((InventoryType)item.InvType == InventoryType.LSL) | ||
280 | { | ||
281 | if (!m_Scene.Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) | ||
282 | { | ||
283 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); | ||
284 | return UUID.Zero; | ||
285 | } | ||
286 | 281 | ||
287 | remoteClient.SendAlertMessage("Script saved"); | 282 | remoteClient.SendAlertMessage("Notecard saved"); |
288 | } | 283 | } |
289 | else if ((CustomInventoryType)item.InvType == CustomInventoryType.AnimationSet) | 284 | else if ((InventoryType)item.InvType == InventoryType.LSL) |
285 | { | ||
286 | if (!m_Scene.Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) | ||
290 | { | 287 | { |
291 | AnimationSet animSet = new AnimationSet(data); | 288 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); |
292 | if (!animSet.Validate(x => { | 289 | return UUID.Zero; |
290 | } | ||
291 | |||
292 | remoteClient.SendAlertMessage("Script saved"); | ||
293 | } | ||
294 | else if ((CustomInventoryType)item.InvType == CustomInventoryType.AnimationSet) | ||
295 | { | ||
296 | AnimationSet animSet = new AnimationSet(data); | ||
297 | if (!animSet.Validate(x => { | ||
293 | int perms = m_Scene.InventoryService.GetAssetPermissions(remoteClient.AgentId, x); | 298 | int perms = m_Scene.InventoryService.GetAssetPermissions(remoteClient.AgentId, x); |
294 | int required = (int)(PermissionMask.Transfer | PermissionMask.Copy); | 299 | int required = (int)(PermissionMask.Transfer | PermissionMask.Copy); |
295 | if ((perms & required) != required) | 300 | if ((perms & required) != required) |
296 | return false; | 301 | return false; |
297 | return true; | 302 | return true; |
298 | })) | 303 | })) |
299 | { | 304 | { |
300 | data = animSet.ToBytes(); | 305 | data = animSet.ToBytes(); |
301 | } | ||
302 | } | 306 | } |
307 | } | ||
303 | 308 | ||
304 | AssetBase asset = | 309 | AssetBase asset = |
305 | CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString()); | 310 | CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString()); |
306 | item.AssetID = asset.FullID; | 311 | item.AssetID = asset.FullID; |
307 | m_Scene.AssetService.Store(asset); | 312 | m_Scene.AssetService.Store(asset); |
308 | |||
309 | m_Scene.InventoryService.UpdateItem(item); | ||
310 | 313 | ||
311 | // remoteClient.SendInventoryItemCreateUpdate(item); | 314 | m_Scene.InventoryService.UpdateItem(item); |
312 | return (asset.FullID); | ||
313 | } | ||
314 | else | ||
315 | { | ||
316 | m_log.ErrorFormat( | ||
317 | "[INVENTORY ACCESS MODULE]: Could not find item {0} for caps inventory update", | ||
318 | itemID); | ||
319 | } | ||
320 | 315 | ||
321 | return UUID.Zero; | 316 | // remoteClient.SendInventoryItemCreateUpdate(item); |
317 | return (asset.FullID); | ||
322 | } | 318 | } |
323 | 319 | ||
324 | public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset) | 320 | public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset) |