Fix session table may be empty if no DC switch

This commit is contained in:
Lonami Exo 2017-12-28 14:58:42 +01:00
parent 50d413b1c9
commit 4a139b0ae4

View File

@ -97,10 +97,12 @@ class Session:
# These values will be saved
c.execute('select * from sessions')
self._dc_id, self._server_address, self._port, key, = c.fetchone()
tuple_ = c.fetchone()
if tuple_:
self._dc_id, self._server_address, self._port, key, = tuple_
from ..crypto import AuthKey
self._auth_key = AuthKey(data=key)
from ..crypto import AuthKey
self._auth_key = AuthKey(data=key)
c.close()
else:
# Tables don't exist, create new ones