Skip to content

Commit be54bca

Browse files
committed
skip zero length components
1 parent edd290e commit be54bca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

avb/components.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,16 @@ def nearest_component_at_time(self, edit_unit):
191191
def nearest_index_at_time(self, edit_unit):
192192
"""returns the index of the nearest component to edit_unit and its start position"""
193193
last_component = None
194-
last_index = None
194+
last_index = 0
195195
last_pos = 0
196196

197-
if edit_unit <= 0:
198-
return 0
199-
200197
# this needs to go past target index to handle Transitions
201198
for index, position, component in self.positions():
202199

200+
# skip zero length FILL components
201+
if component.length == 0:
202+
continue
203+
203204
if component.class_id == b'TNFX':
204205
if position <= edit_unit < position + component.length:
205206
return index, position

0 commit comments

Comments
 (0)