Fix crash on repeated HE shell clicks in Tankopedia armor viewer

This commit is contained in:
Mark Greene committed 2026-07-10 16:03:05 +12:00
1 parent dc6c528167
commit 4571d141e6
1 file changed
+9 -3
@@ -63,10 +63,10 @@ export function ShotDisplay() {
outlineMaterial, outlineMaterial,
).computeLineDistances(); ).computeLineDistances();
splashRadiusWrapper.current.add(outline); splashRadiusWrapper.current?.add(outline);
return () => { return () => {
splashRadiusWrapper.current.remove(outline); splashRadiusWrapper.current?.remove(outline);
}; };
} }
}); });
@@ -283,6 +283,7 @@ function Animator({
const tracerT1 = t % 1; const tracerT1 = t % 1;
const tracerT2 = (t + 0.5) % 1; const tracerT2 = (t + 0.5) % 1;
if (inTracer.current) {
inTracer.current.scale.set(1, 1 - 2 * Math.abs(tracerT1 - 0.5), 1); inTracer.current.scale.set(1, 1 - 2 * Math.abs(tracerT1 - 0.5), 1);
inTracer.current.position.set(0, (1 - tracerT1) * inLength, 0); inTracer.current.position.set(0, (1 - tracerT1) * inLength, 0);
@@ -292,8 +293,13 @@ function Animator({
} }
invalidate(); invalidate();
}
if (shot.splashRadius !== undefined) { if (
shot.splashRadius !== undefined &&
splashRadiusWrapper.current &&
splashRadiusMaterial.current
) {
if (animationStartTime === null) animationStartTime = t; if (animationStartTime === null) animationStartTime = t;
const scale = const scale =