From d67c5ca55d46d2f2b7e7c5098566fee0795c00ba Mon Sep 17 00:00:00 2001
From: unknown <john.schihada@hotmail.com>
Date: Fri, 20 Nov 2020 00:22:01 +0100
Subject: [PATCH] Fixed bug

---
 Assets/Scripts/InventoryStuff/Scroll.cs        |  7 +++++++
 Assets/Scripts/InventoryStuff/ScrollDetails.cs | 11 ++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Assets/Scripts/InventoryStuff/Scroll.cs b/Assets/Scripts/InventoryStuff/Scroll.cs
index 15277b22..8b77dd0d 100644
--- a/Assets/Scripts/InventoryStuff/Scroll.cs
+++ b/Assets/Scripts/InventoryStuff/Scroll.cs
@@ -104,6 +104,13 @@ public class ScrollAssignment
         public OMS assignment;
     }
 
+    public class ScrollApplicationInfo
+    {
+        public Boolean valid;
+        public ScrollApplicationCheckingError[] errors;
+        public List<Scroll.ScrollFact> acquiredFacts;
+    }
+
     public class ScrollDynamicInfo
     {
         public Scroll original;
diff --git a/Assets/Scripts/InventoryStuff/ScrollDetails.cs b/Assets/Scripts/InventoryStuff/ScrollDetails.cs
index 50b9d223..9cdf4d53 100644
--- a/Assets/Scripts/InventoryStuff/ScrollDetails.cs
+++ b/Assets/Scripts/InventoryStuff/ScrollDetails.cs
@@ -72,8 +72,9 @@ public void magicButton()
             PushoutFactFailEvent.Invoke(null);
             return;
         }
-        List<Scroll.ScrollFact> pushoutFacts = JsonConvert.DeserializeObject<List<Scroll.ScrollFact>>(answer);
-        readPushout(pushoutFacts);
+
+        Scroll.ScrollApplicationInfo pushout = JsonConvert.DeserializeObject<Scroll.ScrollApplicationInfo>(answer);
+        readPushout(pushout.acquiredFacts);
     }
 
     public void newAssignment()
@@ -148,7 +149,11 @@ private void readPushout(List<Scroll.ScrollFact> pushoutFacts)
     }
 
     public void processScrollDynamicInfo(Scroll.ScrollDynamicInfo scrollDynamicInfo) {
-        LatestCompletions = scrollDynamicInfo.completions[0];
+
+        if (scrollDynamicInfo.completions.Count != 0)
+            LatestCompletions = scrollDynamicInfo.completions[0];
+        else
+            LatestCompletions = new List<Scroll.ScrollAssignment>();
 
         List<string> completionUris = new List<string>();
         foreach (Scroll.ScrollAssignment currentCompletion in LatestCompletions) {
-- 
GitLab