From ea4e39d7b5b6eaa2f2a186fce01010ebb3798eec Mon Sep 17 00:00:00 2001
From: Birte Kristina Friesel <derf@finalrewind.org>
Date: Sun, 11 Aug 2024 20:38:51 +0200
Subject: [PATCH] do not pass unsupported mot enums to backends

---
 lib/Travel/Status/DE/HAFAS/Services.pm.PL | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/Travel/Status/DE/HAFAS/Services.pm.PL b/lib/Travel/Status/DE/HAFAS/Services.pm.PL
index 00038e5..ae6a754 100644
--- a/lib/Travel/Status/DE/HAFAS/Services.pm.PL
+++ b/lib/Travel/Status/DE/HAFAS/Services.pm.PL
@@ -40,12 +40,16 @@ sub load_instance {
 		}
 	}
 
+	my $skipped = 0;
 	for my $bit ( 0 .. 15 ) {
 		if ( my $p = $bitmask_to_product{ 2**$bit } ) {
+			for ( 1 .. $skipped ) {
+				push( @{ $ret{productbits} }, [ "_", undef ] );
+			}
 			push( @{ $ret{productbits} }, [ $p->{id}, $p->{name} ] );
 		}
 		else {
-			push( @{ $ret{productbits} }, [ "_", undef ] );
+			$skipped += 1;
 		}
 	}
 
-- 
GitLab