diff options
author | SignpostMarv | 2012-07-27 22:15:25 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-27 23:40:19 +0100 |
commit | adbdb220df4aacc93e81eeb2eb1854825e4db7fb (patch) | |
tree | 84b256f94485b99a90483c95a36d7fd83efffaf7 /OpenSim/Framework/RegionInfo.cs | |
parent | adding asset cache and map tile directories to .gitignore (diff) | |
download | opensim-SC-adbdb220df4aacc93e81eeb2eb1854825e4db7fb.zip opensim-SC-adbdb220df4aacc93e81eeb2eb1854825e4db7fb.tar.gz opensim-SC-adbdb220df4aacc93e81eeb2eb1854825e4db7fb.tar.bz2 opensim-SC-adbdb220df4aacc93e81eeb2eb1854825e4db7fb.tar.xz |
making first run more resilient to bad input (loop until good input, rather than crash)
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index a505524..2080a16 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -480,9 +480,16 @@ namespace OpenSim.Framework | |||
480 | MainConsole.Instance.Output("=====================================\n"); | 480 | MainConsole.Instance.Output("=====================================\n"); |
481 | 481 | ||
482 | if (name == String.Empty) | 482 | if (name == String.Empty) |
483 | name = MainConsole.Instance.CmdPrompt("New region name", name); | 483 | { |
484 | if (name == String.Empty) | 484 | while (name.Trim() == string.Empty) |
485 | throw new Exception("Cannot interactively create region with no name"); | 485 | { |
486 | name = MainConsole.Instance.CmdPrompt("New region name", name); | ||
487 | if (name.Trim() == string.Empty) | ||
488 | { | ||
489 | MainConsole.Instance.Output("Cannot interactively create region with no name"); | ||
490 | } | ||
491 | } | ||
492 | } | ||
486 | 493 | ||
487 | source.AddConfig(name); | 494 | source.AddConfig(name); |
488 | 495 | ||
@@ -513,15 +520,20 @@ namespace OpenSim.Framework | |||
513 | // | 520 | // |
514 | allKeys.Remove("RegionUUID"); | 521 | allKeys.Remove("RegionUUID"); |
515 | string regionUUID = config.GetString("RegionUUID", string.Empty); | 522 | string regionUUID = config.GetString("RegionUUID", string.Empty); |
516 | if (regionUUID == String.Empty) | 523 | if (!UUID.TryParse(regionUUID.Trim(), out RegionID)) |
517 | { | 524 | { |
518 | UUID newID = UUID.Random(); | 525 | UUID newID = UUID.Random(); |
519 | 526 | while (RegionID == UUID.Zero) | |
520 | regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString()); | 527 | { |
528 | regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString()); | ||
529 | if (!UUID.TryParse(regionUUID.Trim(), out RegionID)) | ||
530 | { | ||
531 | MainConsole.Instance.Output("RegionUUID must be a valid UUID"); | ||
532 | } | ||
533 | } | ||
521 | config.Set("RegionUUID", regionUUID); | 534 | config.Set("RegionUUID", regionUUID); |
522 | } | 535 | } |
523 | 536 | ||
524 | RegionID = new UUID(regionUUID); | ||
525 | originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?) | 537 | originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?) |
526 | 538 | ||
527 | // Location | 539 | // Location |