Skip to content

Commit 68f82c0

Browse files
author
Sascha Goldhofer
committed
Fix error in get end diff
Fixes a bug, where post replacing of an inserted filepath throws an error and exits with an invalid path
1 parent 2208c64 commit 68f82c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

common/string.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ def get_start_diff(first, second):
2525
return result
2626

2727
def get_end_diff(first, second):
28-
first = first[::-1]
28+
first = first[::-1] # reverse string
2929
second = second[::-1]
30+
second_length = len(second)
3031
index = 0
3132
result = ""
3233
for c in first:
33-
if index in second and c is second[index]:
34+
if index < second_length and c is second[index]:
3435
index += 1
3536
result = c + result
3637
else:

0 commit comments

Comments
 (0)