From 74de03601d5d7f84b7b6e228aeaafaad8f0fabdd Mon Sep 17 00:00:00 2001
From: Botond Baranyi <botond.baranyi@ericsson.com>
Date: Wed, 14 Oct 2020 16:49:40 +0200
Subject: [PATCH] Minor change to the log-match bugfix (bug 567844)

Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com>
Change-Id: I823743ce890ba16e95bfacfd10f4ec71136c94b3
---
 compiler2/union.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/compiler2/union.c b/compiler2/union.c
index a578f32e8..c347fafcc 100644
--- a/compiler2/union.c
+++ b/compiler2/union.c
@@ -3216,8 +3216,9 @@ void defUnionTemplate(const struct_def *sdef, output_struct *output)
     "}\n"
     "if (template_selection == SPECIFIC_VALUE && "
     "single_value.union_selection == match_value.get_selection()) {\n"
-    "size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();\n"
-    "switch (single_value.union_selection) {\n", name, name);
+    "%s"
+    "switch (single_value.union_selection) {\n", name, name,
+    sdef->nElements > 0 ? "size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();\n" : "");
   for (i = 0; i < sdef->nElements; i++) {
     src = mputprintf(src, "case %s_%s:\n"
     "if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){\n"
-- 
GitLab