From 9446565779c219983029c00e27a44bc0b85a1a11 Mon Sep 17 00:00:00 2001 From: taha Date: Mon, 31 Aug 2026 09:21:33 +0300 Subject: [PATCH] early return if added --- lib/core/viewModel/labs_view_model.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/core/viewModel/labs_view_model.dart b/lib/core/viewModel/labs_view_model.dart index cba50b8d..3a776368 100644 --- a/lib/core/viewModel/labs_view_model.dart +++ b/lib/core/viewModel/labs_view_model.dart @@ -171,8 +171,12 @@ class LabsViewModel extends BaseViewModel { } Future openPDF() async { - if(this.attachments?.isNotEmpty == true ){ - if(this.attachments?.first.base64Content == null || this.attachments?.first.base64Content?.isEmpty == true){ + if (this.attachments?.isEmpty == true) { + Utils.showErrorToast("Unable to show Attachments"); + return; + } + + if(this.attachments?.first.base64Content == null || this.attachments?.first.base64Content?.isEmpty == true){ Utils.showErrorToast("Unable to show Attachments"); return; } @@ -183,6 +187,5 @@ class LabsViewModel extends BaseViewModel { } catch (ex) { Utils.showErrorToast("Unable to show Attachments"); } - } } }