From 5962faf05644b9d5321e033a28867c627a811c7f Mon Sep 17 00:00:00 2001 From: Joseph Montanez Date: Mon, 24 May 2021 10:30:04 -0700 Subject: [PATCH 1/2] Update Scene.bf prevent crash when adding component's type is not yet tracked. --- src/Core/Scene.bf | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Core/Scene.bf b/src/Core/Scene.bf index 288ae19..7ea116c 100644 --- a/src/Core/Scene.bf +++ b/src/Core/Scene.bf @@ -104,7 +104,6 @@ namespace Strawberry private void TrackComponent(Component c) { - for (let t in Tracker.AssignmentLists[c.GetType()]) componentTracker[t].Add(c); } From f514bd59281ec94d5e97d05f075e71020f8b385e Mon Sep 17 00:00:00 2001 From: Joseph Montanez Date: Mon, 24 May 2021 10:34:16 -0700 Subject: [PATCH 2/2] Update Scene.bf Add type to componentTracker if the component's type key does not exist. --- src/Core/Scene.bf | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Core/Scene.bf b/src/Core/Scene.bf index 7ea116c..dfb5e14 100644 --- a/src/Core/Scene.bf +++ b/src/Core/Scene.bf @@ -104,7 +104,19 @@ namespace Strawberry private void TrackComponent(Component c) { + for (let t in Tracker.AssignmentLists[c.GetType()]) { + // If component type not in tracker, add to tracker + var match = false; + for (let kvPair in componentTracker) { + if (kvPair.key == t) { + match = true; + } + } + if (!match) { + componentTracker.Add(t, new List()); + } componentTracker[t].Add(c); + } } private void UntrackComponent(Component c)