Make the legacy editor more robust against invalid templates.
Merge pull request #6824 from pchote/external-editor-templates

Fixes #6812