Skip to content

Commit a9071a3

Browse files
committed
entity.get(Explosion)!; could be undefined at runtime
1 parent e7099f5 commit a9071a3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

benches/apps/revade/src/app.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,10 @@ function ExplosionRenderer({ entity }: { entity: Entity }) {
221221

222222
useFrame((_, delta) => {
223223
if (!groupRef.current) return;
224-
const { duration, current } = entity.get(Explosion)!;
224+
const explosion = entity.get(Explosion);
225+
if (!explosion) return;
226+
const { duration, current, velocities } = explosion;
225227
const progress = current / duration;
226-
const velocities = entity.get(Explosion)!.velocities;
227228
const meshes = groupRef.current.children as THREE.Mesh[];
228229

229230
particles.forEach((_, i) => {

0 commit comments

Comments
 (0)