diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 1c8972ee0f..5cd83ea4f9 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -680,29 +680,39 @@ namespace OpenSim.Grid.GridServer
///
///
///
- ///
+ /// A string representing the sim's UUID
/// Information about the sim in XML
public string RestGetSimMethod(string request, string path, string param)
{
string respstring = String.Empty;
RegionProfileData TheSim;
- LLUUID UUID = new LLUUID(param);
- TheSim = getRegion(UUID);
- if (!(TheSim == null))
+ LLUUID UUID;
+ if (LLUUID.TryParse(param, out UUID))
+ {
+ TheSim = getRegion(UUID);
+
+ if (!(TheSim == null))
+ {
+ respstring = "";
+ respstring += "" + TheSim.regionSendKey + "";
+ respstring += "";
+ respstring += "" + TheSim.UUID.ToString() + "";
+ respstring += "" + TheSim.regionName + "";
+ respstring += "" + Util.GetHostFromDNS(TheSim.serverIP).ToString() + "";
+ respstring += "" + TheSim.serverPort.ToString() + "";
+ respstring += "" + TheSim.regionLocX.ToString() + "";
+ respstring += "" + TheSim.regionLocY.ToString() + "";
+ respstring += "1";
+ respstring += "";
+ respstring += "";
+ }
+ }
+ else
{
respstring = "";
- respstring += "" + TheSim.regionSendKey + "";
- respstring += "";
- respstring += "" + TheSim.UUID.ToString() + "";
- respstring += "" + TheSim.regionName + "";
- respstring += "" + Util.GetHostFromDNS(TheSim.serverIP).ToString() + "";
- respstring += "" + TheSim.serverPort.ToString() + "";
- respstring += "" + TheSim.regionLocX.ToString() + "";
- respstring += "" + TheSim.regionLocY.ToString() + "";
- respstring += "1";
- respstring += "";
+ respstring += "Param must be a UUID";
respstring += "";
}