From 5ff2de85b5d2ab0137b45c20db526b2ecbc24589 Mon Sep 17 00:00:00 2001
From: Verena Reimund <reimund@ill.eu>
Date: Wed, 25 Apr 2018 14:49:49 +0200
Subject: [PATCH] ... and corrections for sort x axis implementation

Refs #22197
---
 Framework/Algorithms/src/Stitch1D.cpp | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/Framework/Algorithms/src/Stitch1D.cpp b/Framework/Algorithms/src/Stitch1D.cpp
index 6ab118612d0..a18f5bbbdf1 100644
--- a/Framework/Algorithms/src/Stitch1D.cpp
+++ b/Framework/Algorithms/src/Stitch1D.cpp
@@ -433,16 +433,15 @@ MatrixWorkspace_sptr Stitch1D::sortXAxis(MatrixWorkspace_sptr &inWS) {
         vecdx[l] = (++it)->second;
       ++l;
     }
-    for (size_t i = 0; i < inWS->getNumberHistograms(); ++i) {
-      auto x = make_cow<HistogramX>(std::move(vecx));
-      auto y = make_cow<HistogramY>(std::move(vecy));
-      auto e = make_cow<HistogramE>(std::move(vece));
+    auto x = make_cow<HistogramX>(std::move(vecx));
+    auto y = make_cow<HistogramY>(std::move(vecy));
+    auto e = make_cow<HistogramE>(std::move(vece));
+    inWS->setSharedX(i, x);
+    inWS->setSharedY(i, y);
+    inWS->setSharedE(i, e);
+    if (inWS->hasDx(i)) {
       auto dx = make_cow<HistogramDx>(std::move(vecdx));
-      inWS->setSharedX(i, x);
-      inWS->setSharedY(i, y);
-      inWS->setSharedE(i, e);
-      if (inWS->hasDx(i))
-        inWS->setSharedDx(i, dx);
+      inWS->setSharedDx(i, dx);
     }
   }
   return inWS;
-- 
GitLab