Skip to content

Commit

Permalink
Merge pull request #758 from anatawa12/fix-nre-with-null-colliders
Browse files Browse the repository at this point in the history
fix: NRE if some specified colliders are null
  • Loading branch information
anatawa12 authored Nov 29, 2023
2 parents ee9803a + 392245e commit 6ed9257
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- Error if there are None colliders for PhysBone `#758`

### Security

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- Error if there are None colliders for PhysBone `#758`

### Security

Expand Down
5 changes: 3 additions & 2 deletions Editor/Processors/TraceAndOptimize/OptimizePhysBone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ bool IsAnimated()

foreach (var physBone in context.GetComponents<VRCPhysBoneBase>())
for (var i = 0; i < physBone.colliders.Count; i++)
if (mergedColliders.TryGetValue(physBone.colliders[i], out var mergedTo))
physBone.colliders[i] = mergedTo;
if (physBone.colliders[i])
if (mergedColliders.TryGetValue(physBone.colliders[i], out var mergedTo))
physBone.colliders[i] = mergedTo;

foreach (var colliderBase in mergedColliders.Keys.ToList())
Object.DestroyImmediate(colliderBase);
Expand Down

0 comments on commit 6ed9257

Please sign in to comment.