summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-03-01 10:18:51 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2022-03-01 18:15:57 +0100
commit8ac1dd33493c4093663af5c477b245fd0f89aa15 (patch)
treedb26d6b2be6c90e72473e4f41ba18d72f7168ac1 /hwpfilter
parente650d99c199fc2f453eb239e1c35e4a82a92900b (diff)
ofz: don't register style if hbox load failed
Change-Id: I4d9d5d76f0c2385871003720e933ed1926f66c70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130770 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hwpread.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx
index d0df1cf97ba2..e04e4aa72f6c 100644
--- a/hwpfilter/source/hwpread.cxx
+++ b/hwpfilter/source/hwpread.cxx
@@ -237,7 +237,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);
@@ -366,7 +365,10 @@ bool TxtBox::Read(HWPFile & hwpf)
else
m_pTable = nullptr;
- return !hwpf.State();
+ bSuccess = !hwpf.State();
+ if (bSuccess)
+ hwpf.AddFBoxStyle(&style);
+ return bSuccess;
}
namespace
@@ -511,12 +513,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)
@@ -554,7 +558,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);
@@ -583,7 +586,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)