diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py
index a8c0541bfa..dcf4aa389a 100644
--- a/src/calibre/gui2/tweak_book/editor/text.py
+++ b/src/calibre/gui2/tweak_book/editor/text.py
@@ -871,8 +871,7 @@ class TextEdit(PlainTextEdit):
'color': ('' % color, ''),
'background-color': ('' % color, ''),
}[formatting]
- if hasattr(self.smarts, 'surround_with_custom_tag'):
- self.smarts.surround_with_custom_tag(self, prefix, suffix)
+ self.smarts.surround_with_custom_tag(self, prefix, suffix)
def insert_image(self, href, fullpage=False, preserve_aspect_ratio=False, width=-1, height=-1):
if width <= 0: