From fd9937aa86a5c86ff09cc576787b979c241426d2 Mon Sep 17 00:00:00 2001 From: Harendra Chauhan <47024739+hChauhan4862@users.noreply.github.com> Date: Sun, 6 Nov 2022 23:04:11 +0530 Subject: [PATCH] Fix application crash for elective subjects (#59) * Fix application crash for elective subjects Co-authored-by: Yash Garg --- lib/api/data_api.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/api/data_api.dart b/lib/api/data_api.dart index 6c9ba28..c683386 100644 --- a/lib/api/data_api.dart +++ b/lib/api/data_api.dart @@ -123,9 +123,9 @@ class DataApi { var electiveSubjectDetails = []; - if (response.data[1] != null || - response.data[1]['subject'] != null || - response.data[1] != []) { + if ( + response.data.length >= 2 && + (response.data[1] != null && response.data[1]['subject'] != null && response.data[1] != [])) { electiveSubjectDetails = List.from( response.data[1]['subject'].map( (sub) => SubjectDetails.fromJson(sub),