diff --git a/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php b/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php
index 53d16a88edca787f7b4468d010199441f4195162..9e9ae44dc9b8f092ee3876f1a6bd1d9ada15b02d 100644
--- a/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php
+++ b/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php
@@ -212,6 +212,7 @@ class BrowseLinksController extends AbstractLinkBrowserController
                 }
             }
             if (isset($this->linkAttributeValues['class'])
+                && in_array($this->linkAttributeValues['class'], $classesAnchor['all'])
                 && isset($classesAnchor[$this->displayedLinkHandlerId])
                 && !in_array($this->linkAttributeValues['class'], $classesAnchor[$this->displayedLinkHandlerId], true)
             ) {