From 496b36833425a32e3b720fc79757645be504680e Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 11 Sep 2009 21:52:49 +0100 Subject: [PATCH] Add a using() block around the timer script --- OpenSim/Region/Application/OpenSim.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e6ddb5b739..10071a0d34 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -423,14 +423,16 @@ namespace OpenSim { m_log.Info("[COMMANDFILE]: Running " + fileName); - StreamReader readFile = File.OpenText(fileName); - string currentCommand; - while ((currentCommand = readFile.ReadLine()) != null) + using (StreamReader readFile = File.OpenText(fileName)) { - if (currentCommand != String.Empty) + string currentCommand; + while ((currentCommand = readFile.ReadLine()) != null) { - m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'"); - m_console.RunCommand(currentCommand); + if (currentCommand != String.Empty) + { + m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'"); + m_console.RunCommand(currentCommand); + } } } }