Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: typeset -T crash



On Aug 5,  7:59pm, Mikael Magnusson wrote:
} Subject: typeset -T crash
}
} typeset -T i j k; typeset -T j i k

Something like this?

diff --git a/Src/builtin.c b/Src/builtin.c
index a08a7d4..b32d679 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2680,10 +2680,15 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
 		     */
 		    struct tieddata *tdp = (struct tieddata*)pm->u.data;
 		    /* Update join character */
-		    tdp->joinchar = joinchar;
-		    if (asg0.value.scalar)
-			setsparam(asg0.name, ztrdup(asg0.value.scalar));
-		    return 0;
+		    if (tdp) {
+			tdp->joinchar = joinchar;
+			if (asg0.value.scalar)
+			    setsparam(asg0.name, ztrdup(asg0.value.scalar));
+			return 0;
+		    } else {
+			zwarnnam(name, "can't tie already tied array: %s",
+				 asg0.name);
+		    }
 		} else {
 		    zwarnnam(name, "can't tie already tied scalar: %s",
 			    asg0.name);



Messages sorted by: Reverse Date, Date, Thread, Author