From 409738726d91791fbd3ea2328cea998f644f8787 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 16 Jun 2011 17:14:41 -0700 Subject: Added a couple of guards and warnings to the MapImage/MapImageServiceModule. --- .../ServiceConnectorsOut/MapImage/MapImageServiceModule.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index ee90859..e224670 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs @@ -112,6 +112,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage Object[] args = new Object[] { source }; m_MapService = ServerUtils.LoadPlugin(service, args); + if (m_MapService == null) + { + m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Unable to load LocalServiceModule from {0}. MapService module disabled. Please fix the configuration.", service); + return; + } m_refreshTimer.Enabled = true; m_refreshTimer.AutoReset = true; @@ -202,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage { m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: upload maptile for {0}", scene.RegionInfo.RegionName); - // Create a PNG map tile and upload it to the AddMapTile API + // Create a JPG map tile and upload it to the AddMapTile API byte[] jpgData = Utils.EmptyBytes; IMapImageGenerator tileGenerator = scene.RequestModuleInterface(); if (tileGenerator == null) @@ -220,13 +225,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage } } + if (jpgData == Utils.EmptyBytes) + { + m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Tile image generation failed"); + return; + } + string reason = string.Empty; if (!m_MapService.AddMapTile((int)scene.RegionInfo.RegionLocX, (int)scene.RegionInfo.RegionLocY, jpgData, out reason)) { m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: Unable to upload tile image for {0} at {1}-{2}: {3}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, reason); } - } } } \ No newline at end of file -- cgit v1.1