diff --git a/src/App/Document.cpp b/src/App/Document.cpp index c808d70062..ddfad43c81 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -2303,7 +2303,8 @@ std::vector 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 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; } } }