Skip to content
Snippets Groups Projects
Commit 5693e880 authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Merge pull request #15130 from mantidproject/15129_fix_instrument_view_crash

Fix crash in InstrumentView when adding Peak
parents 22c66925 0a19cb0d
No related branches found
No related tags found
No related merge requests found
......@@ -103,6 +103,9 @@ QString PeakHKL::formatNumber(double h, int prec) {
/// Extract minimum and maximum intensity from peaks workspace for scaling.
void AbstractIntensityScale::setPeaksWorkspace(
const boost::shared_ptr<Mantid::API::IPeaksWorkspace> &pws) {
m_maxIntensity = 0.0;
m_minIntensity = 0.0;
if (pws) {
int peakCount = pws->getNumberPeaks();
......@@ -116,11 +119,10 @@ void AbstractIntensityScale::setPeaksWorkspace(
auto minMaxIntensity =
std::minmax_element(intensities.begin(), intensities.end());
m_maxIntensity = *minMaxIntensity.second;
m_minIntensity = *minMaxIntensity.first;
} else {
m_maxIntensity = 0.0;
m_minIntensity = 0.0;
if (peakCount > 0) {
m_maxIntensity = *minMaxIntensity.second;
m_minIntensity = *minMaxIntensity.first;
}
}
}
......
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