From 1963d946d79846e7f4295e6a57256eaf14442d4f Mon Sep 17 00:00:00 2001 From: Cyprian Klimaszewski Date: Mon, 22 Jun 2026 22:02:40 +0200 Subject: [PATCH] Codefix: Index equal to the list length is also invalid --- nml/actions/action2layout.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nml/actions/action2layout.py b/nml/actions/action2layout.py index 1371e6340..c01cc76fb 100644 --- a/nml/actions/action2layout.py +++ b/nml/actions/action2layout.py @@ -668,9 +668,10 @@ def append_mapping(self, mapping, feature, actions, default, custom_spritesets): spriteset.set_action2(real_action2, feature) ref = expression.SpriteGroupRef(spriteset.name, [], None, spriteset.get_action2(feature)) else: - if spriteset > len(custom_spritesets): + try: + ref = custom_spritesets[spriteset] + except IndexError: raise generic.ScriptError("Index out of range") - ref = custom_spritesets[spriteset] # Skip default result if ref == default: continue