hwpfilter/source/hwpfile.cxx |   46 ++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 24 deletions(-)

New commits:
commit 5827376349b01447280ee4391b03a0f149f88ce4
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Jul 1 09:53:37 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jul 1 12:27:58 2021 +0200

    Related: ofz#33724 detect earlier if comparison shape has no cshape
    
    Change-Id: I23e2c464ffda5de892ae78a188b4c25b81b61fd7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118213
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index 29f25cb39e08..762bb31d0582 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -633,6 +633,8 @@ int HWPFile::compareParaShape(const ParaShape* shape)
     for (int i = 0; i < count; ++i)
     {
         ParaShape *pshape = pslist[i].get();
+        if (!pshape->cshape)
+            continue;
         if (shape->left_margin == pshape->left_margin &&
             shape->right_margin == pshape->right_margin &&
             shape->pspacing_prev == pshape->pspacing_prev &&
@@ -643,8 +645,7 @@ int HWPFile::compareParaShape(const ParaShape* shape)
             shape->outline == pshape->outline &&
             shape->pagebreak == pshape->pagebreak)
         {
-            if (pshape->cshape &&
-                shape->cshape->size == pshape->cshape->size &&
+            if (shape->cshape->size == pshape->cshape->size &&
                 shape->cshape->font[0] == pshape->cshape->font[0] &&
                 shape->cshape->ratio[0] == pshape->cshape->ratio[0] &&
                 shape->cshape->space[0] == pshape->cshape->space[0] &&
commit 57ad52ce8037ce24b4d0a0019e5089c03b90f3c8
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Jul 1 09:52:06 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jul 1 12:27:44 2021 +0200

    can flatten this a level
    
    Change-Id: I71742038c2a2ac8e335a404e99f5412430c0ff8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118212
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index 3a2d2c282e9b..29f25cb39e08 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -630,33 +630,30 @@ int HWPFile::compareParaShape(const ParaShape* shape)
         return 0;
 
     int count = pslist.size();
-    if (count > 0)
+    for (int i = 0; i < count; ++i)
     {
-        for (int i = 0; i < count; ++i)
+        ParaShape *pshape = pslist[i].get();
+        if (shape->left_margin == pshape->left_margin &&
+            shape->right_margin == pshape->right_margin &&
+            shape->pspacing_prev == pshape->pspacing_prev &&
+            shape->pspacing_next == pshape->pspacing_next &&
+            shape->indent == pshape->indent &&
+            shape->lspacing == pshape->lspacing &&
+            shape->arrange_type == pshape->arrange_type &&
+            shape->outline == pshape->outline &&
+            shape->pagebreak == pshape->pagebreak)
         {
-            ParaShape *pshape = pslist[i].get();
-            if (shape->left_margin == pshape->left_margin &&
-                shape->right_margin == pshape->right_margin &&
-                shape->pspacing_prev == pshape->pspacing_prev &&
-                shape->pspacing_next == pshape->pspacing_next &&
-                shape->indent == pshape->indent &&
-                shape->lspacing == pshape->lspacing &&
-                shape->arrange_type == pshape->arrange_type &&
-                shape->outline == pshape->outline &&
-                shape->pagebreak == pshape->pagebreak)
+            if (pshape->cshape &&
+                shape->cshape->size == pshape->cshape->size &&
+                shape->cshape->font[0] == pshape->cshape->font[0] &&
+                shape->cshape->ratio[0] == pshape->cshape->ratio[0] &&
+                shape->cshape->space[0] == pshape->cshape->space[0] &&
+                shape->cshape->color[1] == pshape->cshape->color[1] &&
+                shape->cshape->color[0] == pshape->cshape->color[0] &&
+                shape->cshape->shade == pshape->cshape->shade &&
+                shape->cshape->attr == pshape->cshape->attr)
             {
-                if (pshape->cshape &&
-                    shape->cshape->size == pshape->cshape->size &&
-                    shape->cshape->font[0] == pshape->cshape->font[0] &&
-                    shape->cshape->ratio[0] == pshape->cshape->ratio[0] &&
-                    shape->cshape->space[0] == pshape->cshape->space[0] &&
-                    shape->cshape->color[1] == pshape->cshape->color[1] &&
-                    shape->cshape->color[0] == pshape->cshape->color[0] &&
-                    shape->cshape->shade == pshape->cshape->shade &&
-                    shape->cshape->attr == pshape->cshape->attr)
-                {
-                    return pshape->index;
-                }
+                return pshape->index;
             }
         }
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to