Before this commit:
* Activate debug mode.
* Go to general settings > Document Template.
* Change the Template selection to the empty value.
* Click on "Edit Header".
Result: Traceback.
This happens because we try to concatenate the value of the template
field to a string, and since it's empty (False) boolean and str can't be
implicitly concatenated, this of course raises an uncaught error.
After this commit:
* We check if a template has been selected before performing the
concatenation.
Closes#22736Fixes#22622