diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-01-28 19:50:17 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-01-28 19:50:17 (GMT) |
commit | 024bb4b65356b5ce8b58546d9a9d35c33955aa8d (patch) | |
tree | 359e25a0b71ffa3f278923fb5a4a5071b3bfc639 /src | |
parent | 1e45a8050c8147ce655b86ea6610d8d192826fc3 (diff) | |
download | Doxygen-024bb4b65356b5ce8b58546d9a9d35c33955aa8d.zip Doxygen-024bb4b65356b5ce8b58546d9a9d35c33955aa8d.tar.gz Doxygen-024bb4b65356b5ce8b58546d9a9d35c33955aa8d.tar.bz2 |
Regression: fixed crash due to uninitialized pointer in dotgroupcollaboration.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/dotgroupcollaboration.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp index 4ce57a2..3a14577 100644 --- a/src/dotgroupcollaboration.cpp +++ b/src/dotgroupcollaboration.cpp @@ -156,27 +156,23 @@ DotGroupCollaboration::Edge* DotGroupCollaboration::addEdge( const QCString& _label, const QCString& _url ) { // search a existing link. - Edge *newEdge; - for (const auto &edge : m_edges) - { - if ( edge->pNStart==_pNStart && edge->pNEnd==_pNEnd && edge->eType==_eType) - { // edge already found - newEdge = edge.get(); - break; - } - } - if ( newEdge==0 ) // new link + auto it = std::find_if(m_edges.begin(),m_edges.end(), + [&_pNStart,&_pNEnd,&_eType](const auto &edge) + { return edge->pNStart==_pNStart && edge->pNEnd==_pNEnd && edge->eType==_eType; }); + + if (it==m_edges.end()) // new link { m_edges.emplace_back(std::make_unique<Edge>(_pNStart,_pNEnd,_eType)); - newEdge = m_edges.back().get(); + it = m_edges.end()-1; } - if (!_label.isEmpty()) + if (!_label.isEmpty()) // add label { - newEdge->links.emplace_back(_label,_url); + (*it)->links.emplace_back(_label,_url); } - return newEdge; + // return found or added edge + return (*it).get(); } void DotGroupCollaboration::addCollaborationMember( |