Throw exception in `FormDocument::getHtml()` if form has not been built
authorMatthias Schmidt <gravatronics@live.com>
Sun, 14 Apr 2019 07:33:47 +0000 (09:33 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 14 Apr 2019 07:33:47 +0000 (09:33 +0200)
See #2509

wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php

index 302b00248ce110834c2aafab8502c131dd97ea56..48555ada6afaedd8c4f7259f6af5614ff9b9af18 100644 (file)
@@ -406,6 +406,10 @@ class FormDocument implements IFormDocument {
         * @inheritDoc
         */
        public function getHtml() {
+               if (!$this->isBuilt) {
+                       throw new \BadMethodCallException("The form document has to be built before it can be rendered.");
+               }
+               
                return WCF::getTPL()->fetch(
                        '__form',
                        'wcf',