From 53471dcc594ed93bfc521c0c75ee540143c19487 Mon Sep 17 00:00:00 2001
From: Verena Reimund <reimund@ill.eu>
Date: Fri, 4 May 2018 14:20:39 +0200
Subject: [PATCH] Comments & input check for grouped workspaces

RunCombinationHelper checks, if the ws is a GroupWorkspace or else a MatrixWorkspace. Workspaces of the group were not checked and need to be checked during validation

Refs #22383
---
 Framework/Algorithms/src/ConjoinXRuns.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/Framework/Algorithms/src/ConjoinXRuns.cpp b/Framework/Algorithms/src/ConjoinXRuns.cpp
index d01aebd29c6..fa05dd89b36 100644
--- a/Framework/Algorithms/src/ConjoinXRuns.cpp
+++ b/Framework/Algorithms/src/ConjoinXRuns.cpp
@@ -114,17 +114,21 @@ std::map<std::string, std::string> ConjoinXRuns::validateInputs() {
   m_logEntry = getPropertyValue(SAMPLE_LOG_X_AXIS_PROPERTY);
 
   std::vector<std::string> workspaces;
-  try {
+  try { // input workspace must be a group or a MatrixWorkspace
     workspaces = RunCombinationHelper::unWrapGroups(inputs_given);
   } catch (const std::exception &e) {
     issues[INPUT_WORKSPACE_PROPERTY] = std::string(e.what());
   }
 
-  // find if there are workspaces that are not Matrix or not a point-data
+  // find if there are grouped workspaces that are not Matrix or not a
+  // point-data
   for (const auto &input : workspaces) {
     MatrixWorkspace_sptr ws =
         AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(input);
-    if (ws->isHistogramData()) {
+    if (!ws) {
+      issues[INPUT_WORKSPACE_PROPERTY] +=
+          "Workspace " + input + " is not a MatrixWorkspace\n";
+    } else if (ws->isHistogramData()) {
       issues[INPUT_WORKSPACE_PROPERTY] +=
           "Workspace " + ws->getName() + " is not a point-data\n";
     } else {
@@ -186,7 +190,8 @@ std::string ConjoinXRuns::checkLogEntry(MatrixWorkspace_sptr ws) const {
       try {
         run.getLogAsSingleValue(m_logEntry);
 
-        // try if numeric time series, then the size must match to the blocksize
+        // try if numeric time series, then the size must match to the
+        // blocksize
         const int blocksize = static_cast<int>(ws->blocksize());
 
         TimeSeriesProperty<double> *timeSeriesDouble(nullptr);
-- 
GitLab