diff --git a/MMVII/src/Topo/ctopodata.cpp b/MMVII/src/Topo/ctopodata.cpp index c88b24d880..61a1a7c433 100644 --- a/MMVII/src/Topo/ctopodata.cpp +++ b/MMVII/src/Topo/ctopodata.cpp @@ -270,10 +270,11 @@ bool cTopoData::addObs(std::vector &aCurrentVectObsSetSt if (code != eCompObsType::eCompHzOpen) // new set if HzOpen { // search for a suitable set - for (auto &aObsSet : aCurrentVectObsSetStations) + for (auto riter = aCurrentVectObsSetStations.rbegin(); + riter != aCurrentVectObsSetStations.rend(); ++riter) { - // TODO: must search from end - if ((!aObsSet.mObs.empty()) && (aObsSet.mObs.at(0).mPtsNames.at(0) == nameFrom)) + auto &aObsSet = *riter; + if ((!aObsSet.mObs.empty()) && (aObsSet.mObs.front().mPtsNames.front() == nameFrom)) { aSetDataStation = &aObsSet; break;