From d2f72de88dac50047fe8acdd9af458c2dd06a213 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Fri, 19 Jun 2020 23:47:51 -0400
Subject: [PATCH] reimplementation of ico's fix to correctly send unmatched
 bang to reject xlet

---
 pd/src/x_connective.c                         |  3 +--
 scripts/regression_tests.pd                   |  4 ++-
 scripts/regression_tests/route_reject_bang.pd | 25 +++++++++++++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)
 create mode 100644 scripts/regression_tests/route_reject_bang.pd

diff --git a/pd/src/x_connective.c b/pd/src/x_connective.c
index d7019ab91..a475de003 100644
--- a/pd/src/x_connective.c
+++ b/pd/src/x_connective.c
@@ -579,8 +579,7 @@ static void route_list(t_route *x, t_symbol *sel, int argc, t_atom *argv)
     if (x->x_type == A_FLOAT || x->x_mixed)
     {
         t_float f;
-        if (!argc) return;
-        if (argv->a_type != A_FLOAT)
+        if (!argc || argv->a_type != A_FLOAT)
             goto try_symbol;
         f = atom_getfloat(argv);
         for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++)
diff --git a/scripts/regression_tests.pd b/scripts/regression_tests.pd
index 640fb3785..7b6a767d0 100644
--- a/scripts/regression_tests.pd
+++ b/scripts/regression_tests.pd
@@ -1,4 +1,4 @@
-#N canvas 126 96 749 571 12;
+#N canvas 755 138 749 571 12;
 #X obj 465 281 r \$0-result;
 #X obj 212 239 bng 31 250 50 0 empty empty Run_all 39 13 0 12 -262144
 -1 -1;
@@ -52,6 +52,7 @@ is handy for some binbuf tests.;
 #X obj 127 172 print Done;
 #X obj 198 1701 rtest wrap~_compatibility_bug;
 #X obj 198 1756 rtest select_bang;
+#X obj 198 1811 rtest route_reject_bang;
 #X connect 0 0 27 0;
 #X connect 1 0 4 0;
 #X connect 2 0 42 0;
@@ -89,3 +90,4 @@ is handy for some binbuf tests.;
 #X connect 42 3 3 0;
 #X connect 43 0 44 0;
 #X connect 45 0 46 0;
+#X connect 46 0 47 0;
diff --git a/scripts/regression_tests/route_reject_bang.pd b/scripts/regression_tests/route_reject_bang.pd
new file mode 100644
index 000000000..d9fa2a630
--- /dev/null
+++ b/scripts/regression_tests/route_reject_bang.pd
@@ -0,0 +1,25 @@
+#N canvas 402 151 576 493 12;
+#X obj 100 33 inlet;
+#X msg 21 34 bang;
+#X obj 175 128 route bang;
+#X obj 101 356 outlet;
+#X obj 100 62 trigger bang bang bang;
+#X obj 100 252 float;
+#X msg 281 188 0;
+#X msg 175 95 12;
+#X msg 242 187 1;
+#X obj 242 161 b;
+#X obj 101 311 list append a bang to [route 12] should get output to
+the rejection outlet;
+#X connect 0 0 4 0;
+#X connect 1 0 4 0;
+#X connect 2 1 9 0;
+#X connect 4 0 5 0;
+#X connect 4 1 7 0;
+#X connect 4 2 6 0;
+#X connect 5 0 10 0;
+#X connect 6 0 5 1;
+#X connect 7 0 2 0;
+#X connect 8 0 5 1;
+#X connect 9 0 8 0;
+#X connect 10 0 3 0;
-- 
GitLab