fix(llf): guard against null bsLight/niLight#2140
Conversation
Null-check bsLight and niLight before dereferencing in BSLightingShader_SetupGeometry_GeometrySetupConstantPointLights. Use a write index so StrictLights[] stays contiguous when entries are skipped, and update NumStrictLights to the actual written count. Also guard the ShadowBitMask loop against null bsLight. A BSLight can have a null NiLight smart pointer when the underlying light object is destroyed while still referenced in a render pass. Observed crash: RSI=null (niLight), RCX=0x110 (GetLightRuntimeData SE offset), +0x0C (diffuse) -> access at 0x11C. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughModified light population logic in the point lights setup function to skip null entries using a separate write index counter, ensuring only valid lights are stored and counted. Changed shadow mask bit-shifting from signed to unsigned integers for proper unsigned behavior. Changes
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly Related PRs
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
No actionable suggestions for changed features. |
|
✅ A pre-release build is available for this PR: |
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Null-check bsLight and niLight before dereferencing in BSLightingShader_SetupGeometry_GeometrySetupConstantPointLights. Use a write index so StrictLights[] stays contiguous when entries are skipped, and update NumStrictLights to the actual written count. Also guard the ShadowBitMask loop against null bsLight.
A BSLight can have a null NiLight smart pointer when the underlying light object is destroyed while still referenced in a render pass. Observed crash: RSI=null (niLight), RCX=0x110 (GetLightRuntimeData SE offset), +0x0C (diffuse) -> access at 0x11C.
Summary by CodeRabbit