diff --git a/src/config.py b/src/config.py
index a0e9d4fa0a474de59a855097da85fe329357d7e1..85d3c014afe42f1dbe8b7a37804a8c8790216f0c 100644
--- a/src/config.py
+++ b/src/config.py
@@ -1720,6 +1720,8 @@ class AccountsWindow:
 			remove(account)
 
 	def on_rename_button_clicked(self, widget):
+		if not self.current_account:
+			return
 		enable = gajim.config.get('enable_zeroconf')
 		if (self.current_account != gajim.ZEROCONF_ACC_NAME or enable) and \
 		gajim.connections[self.current_account].connected != 0: