Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
Fix crash when resolving a base or derived class that does not exist …
Browse files Browse the repository at this point in the history
…in xml input
  • Loading branch information
matusnovak committed Jan 12, 2021
1 parent 4de70cf commit e6e37a4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Doxybook/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,29 @@ void Doxybook2::Node::finalize(const Config& config,
if (config.linkLowercase)
url = Utils::toLower(url);

const auto findOrNull = [&](const std::string& refId) -> const Node* {
const auto it = cache.find(refid);
if (it == cache.end()) {
return nullptr;
}
return it->second.get();
};

for (auto& klass : baseClasses) {
if (!klass.refid.empty()) {
klass.ptr = cache.at(klass.refid).get();
klass.ptr = findOrNull(klass.refid);
if (!klass.ptr) {
klass.refid.clear();
}
}
}

for (auto& klass : derivedClasses) {
if (!klass.refid.empty()) {
klass.ptr = cache.at(klass.refid).get();
klass.ptr = findOrNull(klass.refid);
if (!klass.ptr) {
klass.refid.clear();
}
}
}
}
Expand Down

0 comments on commit e6e37a4

Please sign in to comment.