Skip to content

Commit e72386a

Browse files
Thomas Graingergraingert
authored andcommitted
changes is optional
1 parent 0046de3 commit e72386a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

whatthepatch/apply.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ def apply_diff(diff, text, reverse=False, use_patch=False):
9494

9595
n_lines = len(lines)
9696

97-
changes = _reverse(diff.changes) if reverse else diff.changes
97+
changes = diff.changes or []
98+
changes = _reverse(changes) if reverse else changes
9899
# check that the source text matches the context of the diff
99100
for old, new, hunk, line in changes:
100101
# might have to check for line is None here for ed scripts

0 commit comments

Comments
 (0)