From ec912d50740b5ee63f705c08c9487d0a108a04e3 Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Tue, 8 Mar 2016 17:38:29 +0100 Subject: [PATCH] [fix] Protect against empty files --- src/yunohost/service.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 3823aef4..4cedfb35 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -395,8 +395,9 @@ def _get_diff(string, filename): string = string + '\n' new_lines = string.splitlines(True) - while '\n' == file_lines[-1]: - del file_lines[-1] + if file_lines: + while '\n' == file_lines[-1]: + del file_lines[-1] return difflib.unified_diff(file_lines, new_lines) except IOError: return []