From 93e8fb5922a07547f2210cd05dd852d50cb7c259 Mon Sep 17 00:00:00 2001 From: AOIDUO <30717258+UniverseObserver@users.noreply.github.com> Date: Mon, 3 Sep 2018 07:28:55 +0800 Subject: [PATCH] FIX: null assignments[] --- SchoolPower/Models/Subject.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SchoolPower/Models/Subject.cs b/SchoolPower/Models/Subject.cs index 41a78b9..faada78 100644 --- a/SchoolPower/Models/Subject.cs +++ b/SchoolPower/Models/Subject.cs @@ -100,7 +100,10 @@ public Subject(JObject data) { SmallTextFontWeight = FontWeights.Normal; IsActive = GetActivity(StartDate, EndDate); - JArray assignmentsJarray = (JArray)data["assignments"]; + JArray assignmentsJarray = new JArray(); + try { + assignmentsJarray = (JArray)data["assignments"]; + } catch (Exception) { } try { for (int index = 0; index < assignmentsJarray.Count; index++) Assignments.Add(new AssignmentItem((JObject)assignmentsJarray[index]));