From 0c384fbd6977a7e90fbba20d5d15baf0aa81dacb Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philip.kaludercic@fau.de>
Date: Wed, 17 Jan 2024 21:06:27 +0100
Subject: [PATCH] Only extend a comment if there is a last option

Otherwise an empty line between the question and the options results
in an empty option that appears to the user as a "undefined" option.
---
 gen.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gen.pl b/gen.pl
index ab45369..0714f88 100755
--- a/gen.pl
+++ b/gen.pl
@@ -102,7 +102,8 @@ while (<>) {
        "correct" => $1 eq "+" ? JSON::true : $1 eq "-" ? JSON::false : JSON::null
       );
   } elsif (/^.*$/) {		# non-empty line
-    $last_option{"comment"} .= $_;
+    $last_option{"comment"} .= $_
+      if %last_option;
   }
 }
 
-- 
GitLab