Skip to content

Commit

Permalink
Fix the crash. Refs #5195.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed May 29, 2012
1 parent 44d547c commit d2e3aea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Code/Mantid/Framework/DataObjects/src/Workspace2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,22 @@ namespace Mantid
ISpectrum * Workspace2D::getSpectrum(const size_t index)
{
if (index>=m_noVectors)
throw std::range_error("Workspace2D::getSpectrum, histogram number out of range");
{
std::stringstream ss;
ss << "Workspace2D::getSpectrum, histogram number " << index << " out of range " << m_noVectors;
throw std::range_error(ss.str());
}
return data[index];
}

const ISpectrum * Workspace2D::getSpectrum(const size_t index) const
{
if (index>=m_noVectors)
throw std::range_error("Workspace2D::getSpectrum, histogram number out of range");
{
std::stringstream ss;
ss << "Workspace2D::getSpectrum, histogram number " << index << " out of range " << m_noVectors;
throw std::range_error(ss.str());
}
return data[index];
}

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ QwtDoubleRect MantidMatrix::boundingRect()
x_start = x_end = 0;
while(x_start == x_end && i0 <= m_endRow)
{
i0++;
const Mantid::MantidVec& X = m_workspace->readX(i0);
x_start = X[0];
if (X.size() != m_workspace->readY(i0).size()) x_end = X[m_workspace->blocksize()];
Expand All @@ -651,6 +650,7 @@ QwtDoubleRect MantidMatrix::boundingRect()
{
x_start = x_end = 0;
}
i0++;
}

// if i0 > m_endRow there aren't any plottable rows
Expand Down

0 comments on commit d2e3aea

Please sign in to comment.