diff --git a/apps/terminal/models/applet/applet.py b/apps/terminal/models/applet/applet.py index 8bf6b3a85..be8f1e2cc 100644 --- a/apps/terminal/models/applet/applet.py +++ b/apps/terminal/models/applet/applet.py @@ -161,7 +161,9 @@ class Applet(JMSBaseModel): return None prefer_host_account_key = 'applet_host_prefer_account_{}_{}'.format(user.id, host.id) prefer_account_id = cache.get(prefer_host_account_key, None) - prefer_account = accounts.filter(id=prefer_account_id).first() + prefer_account = None + if prefer_account_id: + prefer_account = accounts.filter(id=prefer_account_id).first() if prefer_account: account = prefer_account else: