Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre99999999 committed Oct 10, 2024
1 parent 8104588 commit 3ab4cff
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pwiz/data/vendor_readers/Bruker/SpectrumList_Bruker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,17 +495,20 @@ PWIZ_API_DECL SpectrumPtr SpectrumList_Bruker::spectrum(size_t index, DetailLeve
{
auto mz = result->getMZArray()->data;

auto it = std::min_element(mz.begin(), mz.end());
std::size_t index1 = std::distance(mz.begin(), it);
if (mz.size() > 0)
{
auto it = std::min_element(mz.begin(), mz.end());
std::size_t index1 = std::distance(mz.begin(), it);

it = std::max_element(mz.begin(), mz.end());
std::size_t index2 = std::distance(mz.begin(), it);
it = std::max_element(mz.begin(), mz.end());
std::size_t index2 = std::distance(mz.begin(), it);

if(mz.size()>index1)
result->set(MS_lowest_observed_m_z, mz[index1], MS_m_z);
if (mz.size() > index1)
result->set(MS_lowest_observed_m_z, mz[index1], MS_m_z);

if (mz.size() > index2)
result->set(MS_highest_observed_m_z, mz[index2], MS_m_z);
if (mz.size() > index2)
result->set(MS_highest_observed_m_z, mz[index2], MS_m_z);
}
}
/*}
catch (_com_error& e) // not caught by either std::exception or '...'
Expand Down

0 comments on commit 3ab4cff

Please sign in to comment.