Skip to content

Commit

Permalink
Fix application crash for elective subjects (#59)
Browse files Browse the repository at this point in the history
* Fix application crash for elective subjects

Co-authored-by: Yash Garg <ben10.yashgarg@gmail.com>
  • Loading branch information
hChauhan4862 and Yash-Garg authored Nov 6, 2022
1 parent 93f5207 commit fd9937a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/api/data_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ class DataApi {

var electiveSubjectDetails = <SubjectDetails>[];

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<SubjectDetails>.from(
response.data[1]['subject'].map(
(sub) => SubjectDetails.fromJson(sub),
Expand Down

0 comments on commit fd9937a

Please sign in to comment.