Fix crash on displaying renamed file
A logic error in the method to pretty-print file renames could cause a crash. Ensure that we don't overrun the length of either the old or new path when comparing. Change-Id: I7f1006ec6cbdb723e77cb62b64414a960af04113
This commit is contained in:
parent
1226ef8d57
commit
844ea40f8e
@ -474,13 +474,13 @@ class File(object):
|
||||
return self.path
|
||||
pre = []
|
||||
post = []
|
||||
for start in range(len(self.old_path)):
|
||||
for start in range(min(len(self.old_path), len(self.path))):
|
||||
if self.path[start] == self.old_path[start]:
|
||||
pre.append(self.old_path[start])
|
||||
else:
|
||||
break
|
||||
pre = ''.join(pre)
|
||||
for end in range(1, len(self.old_path)-1):
|
||||
for end in range(1, min(len(self.old_path), len(self.path))-1):
|
||||
if self.path[0-end] == self.old_path[0-end]:
|
||||
post.insert(0, self.old_path[0-end])
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user