]> wagnertech.de Git - kivitendo-erp.git/blobdiff - modules/override/PDF/Table.pm
Endlosschleife im PDF-Tabellenmodul und damit im PDF-Export gefixt
[kivitendo-erp.git] / modules / override / PDF / Table.pm
index 990a2c6c85dcd878a67215b98f8616e7f0e220f7..57372487cbf39f7fe86e476a1bb02bfc61580d2c 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));
         }