diff --git a/web/pgadmin/browser/utils.py b/web/pgadmin/browser/utils.py index 432d5fff8..295e637cb 100644 --- a/web/pgadmin/browser/utils.py +++ b/web/pgadmin/browser/utils.py @@ -41,9 +41,10 @@ def underscore_escape(text): } # always replace & first - for c, r in sorted(html_map.items(), - key=lambda x: 0 if x[0] == '&' else 1): - text = text.replace(c, r) + if text: + for c, r in sorted(html_map.items(), + key=lambda x: 0 if x[0] == '&' else 1): + text = text.replace(c, r) return text @@ -65,8 +66,9 @@ def underscore_unescape(text): } # always replace & first - for c, r in html_map.items(): - text = text.replace(c, r) + if text: + for c, r in html_map.items(): + text = text.replace(c, r) return text