From 3c42f790bda6498e61c78bf1e7ec9c36f7202155 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Wed, 20 Dec 2023 15:50:39 +0100 Subject: [PATCH] Fix --- lib/services/api_client.dart | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/services/api_client.dart b/lib/services/api_client.dart index c2e1fca..b45622a 100644 --- a/lib/services/api_client.dart +++ b/lib/services/api_client.dart @@ -39,10 +39,17 @@ class ApiClientV2 { Future getServerVersion() async { final result = await HttpRequestClient.get(urlPath: '/status', server: server); if (result.successful == true) { - return ApiResponse( - successful: true, - content: jsonDecode(result.body!)['version'] - ); + try { + return ApiResponse( + successful: true, + content: jsonDecode(result.body!)['version'] + ); + } on FormatException { + return const ApiResponse(successful: false); + } catch (e, stackTrace) { + Sentry.captureException(e, stackTrace: stackTrace); + return const ApiResponse(successful: false); + } } else { return const ApiResponse(successful: false);