diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 9f158e4a82e37691fff46efd882f30f8956040b5..b36fd142b8c38d9b9ad6d36083638cbce6eb3e5c 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -1047,7 +1047,9 @@ class Doku_Handler_Preformatted {
                     $this->text .= $call[1][0];
                 break;
                 case 'preformatted_end':
-                    $this->CallWriter->writeCall(array('preformatted',array($this->text),$this->pos));
+                    if (trim($this->text)) {
+                      $this->CallWriter->writeCall(array('preformatted',array($this->text),$this->pos));
+                    }
                 break;
             }
         }