From d1b76b01c49b3dad0647b444181d1ace72557ac2 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 17 May 2021 14:36:10 +0200 Subject: [PATCH] fix: Try clear and try close database --- lib/src/client.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 93a8af9e..6dfd04ed 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -947,14 +947,22 @@ class Client extends MatrixApi { /// Resets all settings and stops the synchronisation. Future clear() async { Logs().outputEvents.clear(); - await database?.clear(id); + try { + await database?.clear(id); + } catch (e, s) { + Logs().e('Unable to clear database', e, s); + } _id = accessToken = syncFilterId = homeserver = _userID = _deviceID = _deviceName = prevBatch = null; _rooms = []; encryption?.dispose(); encryption = null; if (databaseDestroyer != null) { - await database?.close(); + try { + await database?.close(); + } catch (e, s) { + Logs().e('Unable to close database', e, s); + } await databaseDestroyer(this); _database = null; }