hwpfilter/source/hwpread.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
New commits: commit 8b95df7d8d4c4b651e169c73508fcd86833229ea Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Mar 1 10:18:51 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Mar 1 15:08:47 2022 +0100 ofz: don't register style if hbox load failed Change-Id: I4d9d5d76f0c2385871003720e933ed1926f66c70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130755 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 3c06515e563b..85dd89a32f88 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -236,7 +236,6 @@ bool TxtBox::Read(HWPFile & hwpf) hwpf.Read2b(&option, 1); hwpf.Read2b(&ctrl_ch, 1); hwpf.Read2b(style.margin, 12); - hwpf.AddFBoxStyle(&style); hwpf.Read2b(&box_xs, 1); hwpf.Read2b(&box_ys, 1); hwpf.Read2b(&cap_xs, 1); @@ -365,7 +364,10 @@ bool TxtBox::Read(HWPFile & hwpf) else m_pTable = nullptr; - return !hwpf.State(); + bSuccess = !hwpf.State(); + if (bSuccess) + hwpf.AddFBoxStyle(&style); + return bSuccess; } namespace @@ -509,12 +511,14 @@ bool Picture::Read(HWPFile & hwpf) style.boxtype = 'G'; else style.boxtype = 'D'; - hwpf.AddFBoxStyle(&style); // caption hwpf.ReadParaList(caption); - return !hwpf.State(); + bool bSuccess = !hwpf.State(); + if (bSuccess) + hwpf.AddFBoxStyle(&style); + return bSuccess; } // line(15) @@ -551,7 +555,6 @@ bool Line::Read(HWPFile & hwpf) hwpf.Read2b(&option, 1); hwpf.Read2b(&ctrl_ch, 1); hwpf.Read2b(style.margin, 12); - hwpf.AddFBoxStyle(&style); hwpf.Read2b(&box_xs, 1); hwpf.Read2b(&box_ys, 1); hwpf.Read2b(&cap_xs, 1); @@ -580,7 +583,10 @@ bool Line::Read(HWPFile & hwpf) hwpf.Read2b(&color, 1); style.xpos = width; - return !hwpf.State(); + bool bSuccess = !hwpf.State(); + if (bSuccess) + hwpf.AddFBoxStyle(&style); + return bSuccess; } // hidden(15)