From a8cbda5f249ebd13d2aecdd54104d6162f0c3856 Mon Sep 17 00:00:00 2001 From: Matthias Rupp Date: Thu, 19 Jan 2023 20:06:57 +0100 Subject: [PATCH] Fix crash at first start when 'userInfoBox' does not contain 'serverEndpointKey' before API service is initialized (#1362) --- mobile/lib/shared/services/api.service.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/lib/shared/services/api.service.dart b/mobile/lib/shared/services/api.service.dart index 3251883e72..8f8a7c4770 100644 --- a/mobile/lib/shared/services/api.service.dart +++ b/mobile/lib/shared/services/api.service.dart @@ -20,8 +20,8 @@ class ApiService { ApiService() { if (Hive.isBoxOpen(userInfoBox)) { - final endpoint = Hive.box(userInfoBox).get(serverEndpointKey) as String; - if (endpoint.isNotEmpty) { + final endpoint = Hive.box(userInfoBox).get(serverEndpointKey) as String?; + if (endpoint != null && endpoint.isNotEmpty) { setEndpoint(endpoint); } } else {