From 83f5eed94eed3e432249edaa16edccb9c129e2bc Mon Sep 17 00:00:00 2001
From: Russell Taylor <taylorrj@ornl.gov>
Date: Mon, 29 Jun 2009 10:24:45 +0000
Subject: [PATCH] LoadInstrumentFromRaw modified to clear any existing
 instrument instance from the workspace before getting to work. Necessary
 since this algorithm is called when LoadInstrument fails, which can happen
 when a partial Instrument is loaded, leading to confusion. Re #703.

---
 Code/Mantid/DataHandling/src/LoadInstrumentFromRaw.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Code/Mantid/DataHandling/src/LoadInstrumentFromRaw.cpp b/Code/Mantid/DataHandling/src/LoadInstrumentFromRaw.cpp
index 7a2e2f594c8..0883a5adf1b 100644
--- a/Code/Mantid/DataHandling/src/LoadInstrumentFromRaw.cpp
+++ b/Code/Mantid/DataHandling/src/LoadInstrumentFromRaw.cpp
@@ -61,6 +61,10 @@ void LoadInstrumentFromRaw::exec()
     g_log.error("Unable to open file " + m_filename);
     throw Exception::FileError("Unable to open File:" , m_filename);
   }
+
+  // Clear off any existing instrument for this workspace
+  localWorkspace->setInstrument(boost::shared_ptr<Instrument>(new Instrument));
+
   // Get reference to Instrument and set its name
   boost::shared_ptr<API::Instrument> instrument = localWorkspace->getBaseInstrument();
   if (instrument.get() == 0)
-- 
GitLab