Skip to content

Commit

Permalink
Merge pull request #34099 from mantidproject/34094_instrumentview_mas…
Browse files Browse the repository at this point in the history
…kbins_fix

Fix for hard crash when masking bins via Instrumentview
  • Loading branch information
DannyHindson authored Jun 15, 2022
2 parents b39958b + cce776f commit 230505a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions qt/widgets/instrumentview/src/InstrumentActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,11 @@ void InstrumentActor::applyMaskWorkspace() {
}

// Mask bins
m_maskBinsData.mask(m_workspace);

try {
m_maskBinsData.mask(m_workspace);
} catch (std::logic_error &) {
m_messageHandler.giveUserWarning("An error occurred when applying the mask to bins.", "Mantid - Warning");
}
clearMasks();
}

Expand Down
2 changes: 1 addition & 1 deletion qt/widgets/instrumentview/src/MaskBinsData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void MaskBinsData::mask(std::shared_ptr<Mantid::API::MatrixWorkspace> &workspace
[](const size_t spec) -> int { return static_cast<int>(spec); });
auto alg = Mantid::API::AlgorithmManager::Instance().create("MaskBins", -1);
alg->setProperty("InputWorkspace", workspace);
alg->setProperty("OutputWorkspace", workspace);
alg->setPropertyValue("OutputWorkspace", workspace->getName());
alg->setProperty("InputWorkspaceIndexSet", spectraList);
alg->setProperty("XMin", mask.start);
alg->setProperty("XMax", mask.end);
Expand Down

0 comments on commit 230505a

Please sign in to comment.