[master] 525cbc6 Make error details conditional on there being details to show.

Poul-Henning Kamp phk at FreeBSD.org
Mon Jun 6 23:32:06 CEST 2016


commit 525cbc6e442e9ab3bb62665acb4a67e0f05b96ac
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jun 6 21:30:55 2016 +0000

    Make error details conditional on there being details to show.

diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c
index d81c73a..784578a 100644
--- a/lib/libvcc/vcc_action.c
+++ b/lib/libvcc/vcc_action.c
@@ -163,14 +163,16 @@ parse_new(struct vcc *tl)
 		VSB_printf(tl->sb, "Object name '%.*s' already used.\n",
 		    PF(tl->t));
 
-		VSB_printf(tl->sb, "First usage:\n");
-		AN(sy1->def_b);
-		if (sy1->def_e != NULL)
-			vcc_ErrWhere2(tl, sy1->def_b, sy1->def_e);
-		else
-			vcc_ErrWhere(tl, sy1->def_b);
-		VSB_printf(tl->sb, "Redefinition:\n");
-		vcc_ErrWhere(tl, tl->t);
+		if (sy1->def_b) {
+			VSB_printf(tl->sb, "First usage:\n");
+			AN(sy1->def_b);
+			if (sy1->def_e != NULL)
+				vcc_ErrWhere2(tl, sy1->def_b, sy1->def_e);
+			else
+				vcc_ErrWhere(tl, sy1->def_b);
+			VSB_printf(tl->sb, "Redefinition:\n");
+			vcc_ErrWhere(tl, tl->t);
+		}
 		return;
 	}
 



More information about the varnish-commit mailing list