SteamWar/BauSystem
Archiviert
13
0

Merge pull request 'Fix ArrayIndexOutOfBoundsException' (#75) from TNTTracer into master

Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2020-07-19 16:40:23 +02:00
Commit fe916438b1

Datei anzeigen

@ -10,7 +10,7 @@ public class TNTTrace {
private int uniqueID; private int uniqueID;
private int index = 0; private int index = 0;
private float[] positions = new float[243]; private float[] positions = new float[240];
public TNTTrace(int uniqueID) { public TNTTrace(int uniqueID) {
this.uniqueID = uniqueID; this.uniqueID = uniqueID;
@ -21,6 +21,9 @@ public class TNTTrace {
} }
public void addLocation(double x, double y, double z) { public void addLocation(double x, double y, double z) {
if (index >= positions.length) {
positions = Arrays.copyOf(positions, positions.length + 240);
}
positions[index + 0] = (float)x; positions[index + 0] = (float)x;
positions[index + 1] = (float)y; positions[index + 1] = (float)y;
positions[index + 2] = (float)z; positions[index + 2] = (float)z;