hwpfilter/source/hbox.h | 4 +++- hwpfilter/source/hwpreader.cxx | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
New commits: commit c9a4c8a8ab9933949e14de09e80333a0de6612c5 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Mar 14 08:54:53 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Mar 14 11:37:36 2022 +0100 ofz#45525 Null-dereference READ Change-Id: I9d31b89fc7fa9447823ded4f6891b47100215c0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131523 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/hwpfilter/source/hbox.h b/hwpfilter/source/hbox.h index b3bdffa74911..f7813b225dd5 100644 --- a/hwpfilter/source/hbox.h +++ b/hwpfilter/source/hbox.h @@ -361,7 +361,9 @@ struct TxtBox: public FBox /** * Paragraph list */ - std::vector<std::vector<std::unique_ptr<HWPPara>>> plists; + typedef std::vector<std::unique_ptr<HWPPara>> plist_t; + typedef std::vector<plist_t> plists_t; + plists_t plists; /** * Caption diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 6c757409e8dc..5d364586310a 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -3399,7 +3399,9 @@ void HwpReader::makeTable(TxtBox * hbox) mxList->addAttribute("table:protected", sXML_CDATA,"true"); startEl("table:table-cell"); mxList->clear(); - parsePara(hbox->plists[tcell->pCell->key].front().get()); + TxtBox::plist_t& rVec = hbox->plists[tcell->pCell->key]; + if (!rVec.empty()) + parsePara(rVec.front().get()); endEl("table:table-cell"); } endEl("table:table-row"); @@ -3513,7 +3515,7 @@ void HwpReader::makeTextBox(TxtBox * hbox) startEl("draw:text-box"); mxList->clear(); /* If captions are present and it is on the top */ - if( hbox->style.cap_len > 0 && (hbox->cap_pos % 2) && hbox->type == TBL_TYPE ) + if (hbox->style.cap_len > 0 && (hbox->cap_pos % 2) && hbox->type == TBL_TYPE && !hbox->caption.empty()) { parsePara(hbox->caption.front().get()); } @@ -3526,7 +3528,7 @@ void HwpReader::makeTextBox(TxtBox * hbox) parsePara(hbox->plists[0].front().get()); } /* If captions are present and it is on the bottom */ - if( hbox->style.cap_len > 0 && !(hbox->cap_pos % 2) && hbox->type == TBL_TYPE) + if (hbox->style.cap_len > 0 && !(hbox->cap_pos % 2) && hbox->type == TBL_TYPE && !hbox->caption.empty()) { parsePara(hbox->caption.front().get()); }