bin/flat-odf-cleanup.py |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit d933dba2f1740c6289dd7650fdf249326978af56
Author:     Miklos Vajna <[email protected]>
AuthorDate: Wed Feb 2 12:12:02 2022 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Feb 2 14:51:18 2022 +0100

    flat-odf-cleanup: survive already missing settings/scripts
    
    If they are already removed, just don't do anything.
    
    Change-Id: I3ef09ea5de8841820d586b41ed6c86e78bd06b9c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129326
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins

diff --git a/bin/flat-odf-cleanup.py b/bin/flat-odf-cleanup.py
index d9a3f000db28..8311b1f93960 100644
--- a/bin/flat-odf-cleanup.py
+++ b/bin/flat-odf-cleanup.py
@@ -225,10 +225,14 @@ def remove_unused(root):
             
root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}font-face-decls").remove(font)
 
     # remove office:settings
-    
root.remove(root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}settings"))
+    settings = 
root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}settings")
+    if settings:
+        root.remove(settings)
 
     # scripts are almost never needed
-    
root.remove(root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}scripts"))
+    scripts = 
root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}scripts")
+    if scripts:
+        root.remove(scripts)
 
     # TODO: remove rsid attributes
     # TODO: replace embedded image with some tiny one

Reply via email to