fix(BT12-Dev): Projectile NullReferenceException + 잔존 fix (PD 보고 2026-05-13)

원인: ProjectileSpawner.Trigger 영역 BoxCollider2D.isTrigger=true 활성 (단계 2) 직후·Initialize (단계 3) 이전 OnTriggerEnter2D 발화 가능 → _runtime=null → NullReferenceException line 187 → SelfDestruct 미호출 → 영구 잔존.

fix:
1. OnTriggerEnter2D 영역 `_runtime == null || _data == null` defensive return
2. Update 영역 `_data == null` 시 즉시 SelfDestruct (잔존 차단)

본 PM 자성 #10 — race condition 사전 측정 누락. ProjectileSpawner.Trigger 영역 collider 부착 시점·Initialize 호출 시점 영역 사이 OnTriggerEnter2D 발화 가능성 사전 측정 X.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
깃 관리자 2026-05-13 20:12:51 +09:00
parent 69a18052a0
commit 1437720e50
1 changed files with 11 additions and 0 deletions

View File

@ -124,6 +124,13 @@ namespace EerieVillage.Skills.Effectors
protected virtual void Update()
{
// PD 지시 2026-05-13 — Initialize 호출 이전 Update 발화 차단·_data null 시 즉시 SelfDestruct (잔존 차단)
if (_data == null)
{
SelfDestruct();
return;
}
// PD 지시 2026-05-13 — Inspector HitboxSize 변경 즉시 반영
SyncHitboxToData();
@ -162,6 +169,10 @@ namespace EerieVillage.Skills.Effectors
protected virtual void OnTriggerEnter2D(Collider2D other)
{
// PD 지시 2026-05-13 — Initialize 호출 이전 OnTriggerEnter2D 발화 영역 NullReferenceException 차단
// ProjectileSpawner.Trigger 영역 collider 부착 후 Initialize 호출 영역 race 영역 영역 발화 가능
if (_runtime == null || _data == null) return;
if (_hitTargets.Contains(other)) return;
// PD 지시 2026-05-13 — 투사체끼리 충돌 X·통과 정합 (Projectile 컴포넌트 동족 skip·Wall 판정 이전)