[LEDE-DEV] [PATCH usbmode] fix indices of messages

Felix Fietkau nbd at nbd.name
Wed May 24 02:38:47 PDT 2017


On 2017-05-18 15:18, Julian Labus wrote:
> the way how the script checked if a key already exists in a hash
> leads to wrong indices for %messages.
> 
> Signed-off-by: Julian Labus <julian at labus-online.de>
The patch looks a bit convoluted. How about this instead?

--- a/convert-modeswitch.pl
+++ b/convert-modeswitch.pl
@@ -9,7 +9,7 @@ sub add_message {
 	my $msg = shift;
 	my $val = $messages{$msg};
 
-	$val or do {
+	defined($val) or do {
 		$val = $msg_ctr++;
 		$messages{$msg} = $val;
 	};



More information about the Lede-dev mailing list