diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index 9bd94a7c..e0dcb6dc 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -286,6 +286,8 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) { validWSes.push_back(ws->m_iID); } + std::sort(validWSes.begin(), validWSes.end()); + // get the offset remains = remains < 0 ? -((-remains) % validWSes.size()) : remains % validWSes.size();