From 6015fc89a91ce3100dce744d46b34aa1ad71ee92 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Mon, 14 Apr 2014 20:35:21 -0400
Subject: [PATCH] *partial backport of a fix to allow subpatches to be renamed
 with no arguments without losing their inner content (see g_text setto call).
 Thanks to Jonathan Wilkes for the bug report.

---
 pd/src/g_text.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index ddf788113..191630d8a 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -2205,12 +2205,11 @@ void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos)
         vec2 = binbuf_getvec(b);
         /* special case: if pd subpatch is valid and its args change,
            and its new name is valid, just pass the message on. */
-        if (x->te_pd == canvas_class &&
-            (natom1 >= 1 && natom2 >= 1 && vec1[0].a_type == A_SYMBOL
-            && !strcmp(vec1[0].a_w.w_symbol->s_name, "pd") &&
-             vec2[0].a_type == A_SYMBOL
-            && !strcmp(vec2[0].a_w.w_symbol->s_name, "pd") &&
-            vec2[1].a_type == A_SYMBOL))
+        if (x->te_pd == canvas_class && natom1 >= 1 && natom2 >= 1
+            && vec1[0].a_type == A_SYMBOL
+            && !strcmp(vec1[0].a_w.w_symbol->s_name, "pd")
+            && vec2[0].a_type == A_SYMBOL
+            && !strcmp(vec2[0].a_w.w_symbol->s_name, "pd"))
         {
             //fprintf(stderr,"setto canvas\n");
             //first check if the contents have changed to see if there is
-- 
GitLab