summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog4
-rw-r--r--src/jobs.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4bc9181..f5e0dbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-03-07  Larry Doolittle <ldoolitt@recycle.lbl.gov>
+
+	* Fix cmdtxt crash on if statements.
+
 2008-01-01  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Fix slash treatment in expmeta.
diff --git a/src/jobs.c b/src/jobs.c
index 529d615..40dc8f6 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -1235,11 +1235,12 @@ donode:
 		cmdputs("if ");
 		cmdtxt(n->nif.test);
 		cmdputs("; then ");
-		n = n->nif.ifpart;
 		if (n->nif.elsepart) {
-			cmdtxt(n);
+			cmdtxt(n->nif.ifpart);
 			cmdputs("; else ");
 			n = n->nif.elsepart;
+		} else {
+			n = n->nif.ifpart;
 		}
 		p = "; fi";
 		goto dotail;