aboutsummaryrefslogtreecommitdiff
path: root/editors/awk.c
diff options
context:
space:
mode:
Diffstat (limited to 'editors/awk.c')
-rw-r--r--editors/awk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 9d74d931d..b9c8d2130 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -598,6 +598,7 @@ static const char EMSG_NOT_ARRAY[] ALIGN1 = "Not an array";
598static const char EMSG_POSSIBLE_ERROR[] ALIGN1 = "Possible syntax error"; 598static const char EMSG_POSSIBLE_ERROR[] ALIGN1 = "Possible syntax error";
599static const char EMSG_UNDEF_FUNC[] ALIGN1 = "Call to undefined function"; 599static const char EMSG_UNDEF_FUNC[] ALIGN1 = "Call to undefined function";
600static const char EMSG_NO_MATH[] ALIGN1 = "Math support is not compiled in"; 600static const char EMSG_NO_MATH[] ALIGN1 = "Math support is not compiled in";
601static const char EMSG_NEGATIVE_FIELD[] ALIGN1 = "Access to negative field";
601 602
602static void zero_out_var(var *vp) 603static void zero_out_var(var *vp)
603{ 604{
@@ -2953,6 +2954,8 @@ static var *evaluate(node *op, var *res)
2953 2954
2954 case XC( OC_FIELD ): { 2955 case XC( OC_FIELD ): {
2955 int i = (int)getvar_i(R.v); 2956 int i = (int)getvar_i(R.v);
2957 if (i < 0)
2958 syntax_error(EMSG_NEGATIVE_FIELD);
2956 if (i == 0) { 2959 if (i == 0) {
2957 res = intvar[F0]; 2960 res = intvar[F0];
2958 } else { 2961 } else {