From 8c59638522d8ed06cb962d41c11d1fade27abaa9 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sat, 17 Feb 2024 20:27:56 -0800 Subject: 52556: fix crash when changing type of unset referent via named reference --- Src/builtin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Src') diff --git a/Src/builtin.c b/Src/builtin.c index 5c5adb9d3..dd352c146 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2031,8 +2031,10 @@ typeset_single(char *cname, char *pname, Param pm, int func, char *subscript; if (pm && (pm->node.flags & PM_NAMEREF) && !((off|on) & PM_NAMEREF)) { - if (!(off & PM_NAMEREF)) - pm = (Param)resolve_nameref(pm, NULL); + if (!(off & PM_NAMEREF)) { + if ((pm = (Param)resolve_nameref(pm, NULL))) + pname = pm->node.nam; + } if (pm && (pm->node.flags & PM_NAMEREF) && (on & ~(PM_NAMEREF|PM_LOCAL|PM_READONLY))) { /* Changing type of PM_SPECIAL|PM_AUTOLOAD is a fatal error. * -- cgit 1.4.1