correctly handle return from Db::getDoc(udi...

This commit is contained in:
Jean-Francois Dockes 2012-10-12 13:37:54 +02:00
parent da4e576330
commit 382ae1f718
2 changed files with 5 additions and 3 deletions

View File

@ -128,7 +128,8 @@ bool DocSequenceDb::getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc)
if (!FileInterner::getEnclosing(doc.url, doc.ipath, pdoc.url, pdoc.ipath,
udi))
return false;
return m_q->whatDb()->getDoc(udi, pdoc);
bool dbret = m_q->whatDb()->getDoc(udi, pdoc);
return dbret && pdoc.pc != -1;
}
list<string> DocSequenceDb::expand(Rcl::Doc &doc)

View File

@ -135,7 +135,7 @@ bool DocSequenceHistory::getDoc(int num, Rcl::Doc &doc, string *sh)
sh->erase();
}
bool ret = m_db->getDoc(m_it->udi, doc);
if (!ret) {
if (!ret || doc.pc == -1) {
doc.url = "UNKNOWN";
doc.ipath = "";
}
@ -148,7 +148,8 @@ bool DocSequenceHistory::getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc)
if (!FileInterner::getEnclosing(doc.url, doc.ipath, pdoc.url, pdoc.ipath,
udi))
return false;
return m_db->getDoc(udi, pdoc);
bool dbret = m_db->getDoc(udi, pdoc);
return dbret && pdoc.pc != -1;
}
int DocSequenceHistory::getResCnt()