Endlosschleife im PDF-Tabellenmodul und damit im PDF-Export gefixt
[kivitendo-erp.git] / modules / override / PDF / Table.pm
index 990a2c6..5737248 100755 (executable)
@@ -211,8 +211,12 @@ sub text_block
         }
 
         # Lets take from paragraph as many words as we can put into $width - $indent;
-        while ( @paragraph and $text_object->advancewidth( join("\x20", @line)."\x20" . $paragraph[0]) +
-                                $line_width < $width )
+        # Always take at least one word; otherwise we'd end up in an infinite loop.
+        while ( !scalar(@line) || (
+          @paragraph && (
+            $text_object->advancewidth( join("\x20", @line)."\x20" . $paragraph[0]) + $line_width < $width
+          )
+        ))
         {
             push(@line, shift(@paragraph));
         }