[BUGFIX] Catch Exceptions in RTE with invalid links
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Html / RteHtmlParser.php
index 6190d75..d853a7f 100644 (file)
@@ -596,7 +596,12 @@ class RteHtmlParser extends HtmlParser implements LoggerAwareInterface
                     }
                 } else {
                     // Otherwise store the link as <a> tag as default by TYPO3, with the new link service syntax
-                    $tagAttributes['href'] = $linkService->asString($linkInformation);
+                    try {
+                        $tagAttributes['href'] = $linkService->asString($linkInformation);
+                    } catch (UnknownLinkHandlerException $e) {
+                        $tagAttributes['href'] = $linkInformation['href'] ?? $tagAttributes['href'];
+                    }
+
                     $blockSplit[$k] = '<a ' . GeneralUtility::implodeAttributes($tagAttributes, true) . '>'
                         . $this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])) . '</a>';
                 }