diff -r ca32821c5fe9 nml/actions/action0.py --- a/nml/actions/action0.py Sat Nov 14 11:35:12 2015 +0100 +++ b/nml/actions/action0.py Fri Dec 11 19:09:38 2015 +0100 @@ -969,15 +969,16 @@ def parse_sort_block(feature, vehid_list): prop_num = [0x1A, 0x20, 0x1B, 0x1B] action_list = [] - last = vehid_list[0] - idx = len(vehid_list) - 1 - while idx >= 0: - cur = vehid_list[idx] - prop = Action0Property(prop_num[feature], [last], 3) - action_list.append(Action0(feature, cur.value)) - action_list[-1].prop_list.append(prop) - last = cur - idx -= 1 + if len(vehid_list) > 0: + last = vehid_list[0] + idx = len(vehid_list) - 1 + while idx >= 0: + cur = vehid_list[idx] + prop = Action0Property(prop_num[feature], [last], 3) + action_list.append(Action0(feature, cur.value)) + action_list[-1].prop_list.append(prop) + last = cur + idx -= 1 return action_list callback_flag_properties = {