Move code that is the same for both branches out
of the if/else for reuse, instead of duplicating
the logic in both branches.
Change-Id: I0f960012b51354229968a4ca8cd8b0c6a241e4cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203473
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>