diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
index 0128fc4ef2137b33db40efa1cfbe85666c8da7a1..1b7caca162fb56e8c0958da94e4f04a2eb92532f 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
@@ -3847,7 +3847,10 @@ class ContentObjectRenderer implements LoggerAwareInterface
                     // decode HTML entities, they're encoded later again
                     $attrib = GeneralUtility::get_tag_attributes('<' . $fwParts[0] . '>', true);
                     $str_content = $backParts[0];
-                    $sameBeginEnd = substr(strtolower($backParts[1]), 1, strlen($tagName)) === strtolower($tagName);
+                    // Ensure that $backParts could be exploded into 2 items
+                    if (isset($backParts[1])) {
+                        $sameBeginEnd = strtolower(substr($backParts[1], 1, strlen($tagName))) === strtolower($tagName);
+                    }
                 }
             }
             if ($sameBeginEnd && in_array(strtolower($tagName), $encapTags)) {