From 92d273995c487edcffde501bf05a2905aef2e99c Mon Sep 17 00:00:00 2001
From: Kaz Kylheku <kaz@kylheku.com>
Date: Mon, 19 Jun 2017 16:59:59 -0700
Subject: bugfix: regression in horizontal @(trailer)

* match.c (h_trailer): Prevent LOG_MATCH call from
being evaluated in failed case, when the position is nil.
This situation triggers an exception, because LOG_MATCH
prints the position as an integer using ~d.
---
 match.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/match.c b/match.c
index d06d7c76..a87c09e5 100644
--- a/match.c
+++ b/match.c
@@ -1247,10 +1247,10 @@ static val h_trailer(match_line_ctx *c)
     if (!new_pos) {
       LOG_MISMATCH("trailer");
       ret = nil;
+    } else {
+      LOG_MATCH("trailer", new_pos);
+      ret = cons(new_bindings, plus(c->pos, c->base));
     }
-
-    LOG_MATCH("trailer", new_pos);
-    ret = cons(new_bindings, plus(c->pos, c->base));
   }
 
   uw_unwind {
-- 
cgit v1.2.3