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 6bec738f4..48e836996 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3653,7 +3653,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;