diff --git a/include/html2text.php b/include/html2text.php
index f0fdf4fefdda0a1abd87b47cc5fdecbe9d07ff8a..4efeada88363321df825b2227b239b977d3c7cd1 100644
--- a/include/html2text.php
+++ b/include/html2text.php
@@ -588,6 +588,9 @@ class HtmlTable extends HtmlBlockElement {
         foreach ($rows as $r)
             $cols = max($cols, count($r));
 
+        if (!$cols)
+            return '';
+
         # Find the largest cells in all columns
         $weights = $mins = array_fill(0, $cols, 0);
         foreach ($rows as $r) {