about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index b0759c3a5..cf0a1da85 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3655,7 +3655,7 @@ bin_print(char *name, char **args, Options ops, int func)
 	    
 	    /* copy only one of each flag as spec has finite size */
 	    memset(flags, 0, sizeof(flags));
-	    while ((flag = strchr(flagch, *c))) {
+	    while (*c && (flag = strchr(flagch, *c))) {
 	    	if (!flags[flag - flagch]) {
 	    	    flags[flag - flagch] = 1;
 		    *d++ = *c;