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"); } - } } }