From 9efe49afbd26a14f32606f577c3120022f985ffb Mon Sep 17 00:00:00 2001 From: Sollace Date: Tue, 28 May 2024 14:32:31 +0100 Subject: [PATCH] Fix error printed when respawning --- .../unicopia/network/track/DataTracker.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/network/track/DataTracker.java b/src/main/java/com/minelittlepony/unicopia/network/track/DataTracker.java index 193246d3..1bc68115 100644 --- a/src/main/java/com/minelittlepony/unicopia/network/track/DataTracker.java +++ b/src/main/java/com/minelittlepony/unicopia/network/track/DataTracker.java @@ -59,10 +59,12 @@ public class DataTracker { synchronized void copyTo(DataTracker destination) { for (int i = 0; i < codecs.size(); i++) { ((Pair)destination.codecs.get(i)).value = codecs.get(i).value; - TrackableObject a = persistentObjects.get(i); - TrackableObject b = destination.persistentObjects.get(i); - if (a != null && b != null) { - ((TrackableObject)a).copyTo(b); + if (i < persistentObjects.size() && i < destination.persistentObjects.size()) { + TrackableObject a = persistentObjects.get(i); + TrackableObject b = destination.persistentObjects.get(i); + if (a != null && b != null) { + ((TrackableObject)a).copyTo(b); + } } } }