From 6f4ff48b99f7cb1ecc1d587e5af1f0c8cc631e2c Mon Sep 17 00:00:00 2001 From: Applin Date: Mon, 19 Aug 2024 15:50:03 +0100 Subject: [PATCH] Set property only if it exists in loader --- qt/widgets/spectroscopy/src/InelasticTab.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qt/widgets/spectroscopy/src/InelasticTab.cpp b/qt/widgets/spectroscopy/src/InelasticTab.cpp index defe52cd7f87..8c74a4aedeb3 100644 --- a/qt/widgets/spectroscopy/src/InelasticTab.cpp +++ b/qt/widgets/spectroscopy/src/InelasticTab.cpp @@ -42,6 +42,8 @@ std::string castToString(int value) { return boost::lexical_cast(va template void setPropertyIf(const Algorithm_sptr &algorithm, std::string const &propName, std::string const &value, Predicate const &condition) { + if (!algorithm->existsProperty(propName)) + return; if (condition) algorithm->setPropertyValue(propName, value); } @@ -127,9 +129,7 @@ void InelasticTab::exportPythonScript() { */ bool InelasticTab::loadFile(const std::string &filename, const std::string &outputName, const int specMin, const int specMax, bool loadHistory) { - const auto algName = loadHistory ? "Load" : "LoadNexusProcessed"; - - auto loader = AlgorithmManager::Instance().createUnmanaged(algName, -1); + auto loader = AlgorithmManager::Instance().createUnmanaged("Load", -1); loader->initialize(); loader->setProperty("Filename", filename); loader->setProperty("OutputWorkspace", outputName);