Skip to content

Commit

Permalink
Only add workspace index in FSG if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
robertapplin committed Jan 11, 2024
1 parent a8d8c1e commit 185b908
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions qt/widgets/common/src/FitScriptGeneratorPresenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,12 @@ void FitScriptGeneratorPresenter::setWorkspaces(QStringList const &workspaceName
void FitScriptGeneratorPresenter::addWorkspaces(std::vector<MatrixWorkspace_const_sptr> const &workspaces,
FunctionModelSpectra const &workspaceIndices) {
for (auto const &workspace : workspaces) {
auto const maxIndex = workspace->getNumberHistograms() - 1u;
for (auto const &workspaceIndex : workspaceIndices) {
auto const xData = workspace->x(workspaceIndex.value);
addWorkspace(workspace, workspaceIndex, xData.front(), xData.back());
if (workspaceIndex.value <= maxIndex) {
auto const xData = workspace->x(workspaceIndex.value);
addWorkspace(workspace, workspaceIndex, xData.front(), xData.back());
}
}
}
checkForWarningMessages();
Expand Down

0 comments on commit 185b908

Please sign in to comment.