mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Protect against empty files
This commit is contained in:
parent
7241869985
commit
ec912d5074
1 changed files with 3 additions and 2 deletions
|
@ -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 []
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue