Commit 9f543e3e authored by Victor Yacovlev's avatar Victor Yacovlev

DocBookViewer: Fixed crash on empty xi:include content

parent 4ef3a500
......@@ -246,7 +246,8 @@ bool DocBookFactory::startElement(
innerFactory->parseDocument(&file, hrefUrl, &localError);
if (include) {
if (root_) {
include->setParent(root_);
include->parent_ = root_;
root_->children_.append(include);
}
else {
root_ = include;
......
......@@ -80,28 +80,6 @@ ModelPtr DocBookModel::indexParent() const
return indexParent_;
}
void DocBookModel::setParent(ModelPtr parent)
{
if (parent_) {
for (ModelIterator it=parent_->children_.begin();
it!=parent_->children_.end();)
{
const ModelPtr & ptr = *it;
if (ptr.data() == this) {
it = parent_->children_.erase(it);
}
else {
it ++;
}
}
}
parent_ = parent;
if (parent_) {
parent_->children_.append(ModelPtr(this));
}
updateSectionLevel();
}
const QList<ModelPtr>& DocBookModel::children() const
{
return children_;
......
......@@ -75,7 +75,6 @@ public:
ModelPtr parent() const;
ModelPtr indexParent() const;
const QList<ModelPtr>& children() const;
void setParent(ModelPtr parent);
bool isSectioningNode() const;
const QImage& imageData() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment