Thu Jan 20 21:23:11 2011 UTC ()
avoid crash if certain operations are done before an input record is
read, ie in a BEGIN rule


(drochner)
diff -r1.3 -r1.4 src/external/historical/nawk/dist/lib.c

cvs diff -r1.3 -r1.4 src/external/historical/nawk/dist/lib.c (expand / switch to context diff)
--- src/external/historical/nawk/dist/lib.c 2010/11/07 22:55:26 1.3
+++ src/external/historical/nawk/dist/lib.c 2011/01/20 21:23:11 1.4
@@ -328,7 +328,9 @@
 	}
 	fr = fields;
 	i = 0;	/* number of fields accumulated here */
-	if (inputFS[0] && inputFS[1]) {	/* it's a regular expression */
+	if (!inputFS) {
+		/* do nothing */
+	} else if (inputFS[0] && inputFS[1]) {	/* it's a regular expression */
 		i = refldbld(r, inputFS);
 	} else if ((sep = *inputFS) == ' ') {	/* default whitespace */
 		for (i = 0; ; ) {