diff --git a/gen.pl b/gen.pl
index ab4536973f685010aa303bdfa25d0e3d7bb423c0..0714f8878cd3669a3e52e9c414398f5bc1e7ce59 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;
   }
 }