Skip to content
Snippets Groups Projects
Commit f59fc7c0 authored by Harriet Brown's avatar Harriet Brown
Browse files

Fix bug in SavePDFGui causing crash in histograms

This PR fixes a bug in SavePDFGui that caused a failure when given histogram data.

re: #27774
parent a59f035c
No related branches found
No related tags found
No related merge requests found
......@@ -115,10 +115,18 @@ void SavePDFGui::exec() {
if (inputWS->sharedDx(0))
dx = inputWS->dx(0);
const size_t length = x.size();
for (size_t i = 0; i < length; ++i) {
out << " " << x[i] << " " << y[i] << " " << dx[i] << " " << dy[i]
<< "\n";
if (x.size() == y.size()) {
for (size_t i = 0; i < length; ++i) {
out << " " << x[i] << " " << y[i] << " " << dx[i] << " " << dy[i]
<< "\n";
}
} else {
for (size_t i = 0; i < length - 1; ++i) {
out << " " << (x[i] + x[i + 1]) / 2.0 << " " << y[i] << " " << dx[i]
<< " " << dy[i] << "\n";
}
}
// --------- close the file
out.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment