Visually improve comment without author (Gopher)
authorNiki Roo <niki@nikiroo.be>
Fri, 23 Mar 2018 22:21:24 +0000 (23:21 +0100)
committerNiki Roo <niki@nikiroo.be>
Fri, 23 Mar 2018 22:21:24 +0000 (23:21 +0100)
src/be/nikiroo/gofetch/output/Gopher.java

index 51da87fb338f5ea4cd8fdc475a210035bf63f8a9..f0c6f6dad69d90d2dd09d20baad1b4fec82fca67 100644 (file)
@@ -68,10 +68,13 @@ public class Gopher extends Output {
                }
 
                appendLeft(builder, menu, comment.getTitle(), "** ", "   ", space);
-               appendLeft(builder, menu, "(" + comment.getAuthor() + ")", "   ",
-                               "   ", space);
 
-               builder.append((menu ? "i" : "") + "\r\n");
+               if (comment.getAuthor() != null
+                               && !comment.getAuthor().trim().isEmpty()) {
+                       appendLeft(builder, menu, "(" + comment.getAuthor() + ")", "   ",
+                                       "   ", space);
+                       builder.append((menu ? "i" : "") + "\r\n");
+               }
 
                for (String line : comment.getContentLines()) {
                        int depth = 0;