fdo#82614: sw: Revert "Simplify code path"

This reverts commit 07c00671443f3f0a2e2e6c3a54c391f040e8fd2b.

The bug is because the check of the GotoHeaderTxt() is inverted.

Actually in the old code it is a bit easier to understand what is intended,
even though it is more verbose, so just revert the commit.

(cherry picked from commit 86910c87c193345e5e36104e21b8e26790d6846d)