verify iterators in partialTopologicalSort to be on the safe side

currently this can cause a crash because issue 3214 is not fixed yet
See also: https://forum.freecadweb.org/viewtopic.php?f=19&t=26295
This commit is contained in:
wmayer
2018-01-10 22:16:39 +01:00
parent 39a34c1d27
commit 6a15a2f31e

View File

@@ -2303,7 +2303,8 @@ std::vector<App::DocumentObject*> DocumentP::partialTopologicalSort(const std::v
for (auto outListIt : out) {
auto outListMapIt = countMap.find(outListIt);
outListMapIt->second.first = outListMapIt->second.first - 1;
if (outListMapIt != countMap.end())
outListMapIt->second.first = outListMapIt->second.first - 1;
}
}
}
@@ -2337,7 +2338,8 @@ std::vector<App::DocumentObject*> DocumentP::partialTopologicalSort(const std::v
for (auto inListIt : in) {
auto inListMapIt = countMap.find(inListIt);
inListMapIt->second.second = inListMapIt->second.second - 1;
if (inListMapIt != countMap.end())
inListMapIt->second.second = inListMapIt->second.second - 1;
}
}
}