qdoc: Added safety checks to findUnambiguousTarget()

This is a blind attempt to fix QTBUG-26615. I can't
reproduce the crash on OSX.

Task nr: QTBUG-26615

Change-Id: Ifc6b68b7f302b9cd7d02129be8ae56841a35e5de
Reviewed-by: Martin Smith <martin.smith@nokia.com>
This commit is contained in:
Martin Smith 2012-07-26 14:16:58 +02:00 committed by Qt by Nokia
parent ff1ea44b67
commit d294ac8d68

View File

@ -497,6 +497,9 @@ Tree::findUnambiguousTarget(const QString& target, Atom *&atom, const Node* rela
int numBestTargets = 0;
QList<Target> bestTargetList;
if (priv == 0)
return 0;
for (int pass = 0; pass < NumSuffixes; ++pass) {
TargetHash::const_iterator i = priv->targetHash.constFind(Doc::canonicalTitle(target + suffixes[pass]));
if (i != priv->targetHash.constEnd()) {
@ -523,7 +526,7 @@ Tree::findUnambiguousTarget(const QString& target, Atom *&atom, const Node* rela
if (relative && !relative->qmlModuleIdentifier().isEmpty()) {
for (int i=0; i<bestTargetList.size(); ++i) {
const Node* n = bestTargetList.at(i).node;
if (relative->qmlModuleIdentifier() == n->qmlModuleIdentifier()) {
if (n && relative->qmlModuleIdentifier() == n->qmlModuleIdentifier()) {
atom = bestTargetList.at(i).atom;
return n;
}