summaryrefslogtreecommitdiff
path: root/Src/subst.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 14947ae36..d68159227 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1489,11 +1489,18 @@ subst_parse_str(char **sp, int single, int err)
static char *
substevalchar(char *ptr)
{
- zlong ires = mathevali(ptr);
+ zlong ires;
int len = 0;
+ int saved_errflag = errflag;
- if (errflag)
- return NULL;
+ errflag = 0;
+ ires = mathevali(ptr);
+
+ if (errflag) { /* not a valid numerical expression */
+ errflag |= saved_errflag;
+ return noerrs ? dupstring(""): NULL;
+ }
+ errflag |= saved_errflag;
#ifdef MULTIBYTE_SUPPORT
if (isset(MULTIBYTE) && ires > 127) {
/* '\\' + 'U' + 8 bytes of character + '\0' */