Skip to content

Commit

Permalink
(config/template) prevent empty template result from failing.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdSchellevis committed Aug 31, 2015
1 parent 5b39c0a commit 574a301
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/opnsense/service/modules/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def generate(self, module_name, create_directory=True):
# Check if the last character of our output contains an end-of-line, if not copy it in if
# it was in the original template.
# It looks like Jinja sometimes isn't consistent on placing this last end-of-line in.
if content[-1] != '\n':
if len(content) > 1 and content[-1] != '\n':
src_file = '%s%s'%(self._template_dir,template_filename)
src_file_handle = open(src_file,'r')
src_file_handle.seek(-1, os.SEEK_END)
Expand Down

0 comments on commit 574a301

Please sign in to comment.