Skip to content

Commit

Permalink
Fix hashmap corruption by using an immutable key object
Browse files Browse the repository at this point in the history
  • Loading branch information
douira committed Jan 30, 2025
1 parent d2f2d74 commit db29175
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public void addUnalignedPlane(SectionPos sectionPos, Vector3fc normal, float dis
var normalPlanes = unalignedDistances.get(cleanedNormal);
if (normalPlanes == null) {
normalPlanes = new NormalPlanes(sectionPos, new Vector3f(normal));
unalignedDistances.put(cleanedNormal, normalPlanes);

// NOTE: importantly use the cleaned normal here, not the cleanedNormal, which is mutable
unalignedDistances.put(normalPlanes.normal, normalPlanes);
}
normalPlanes.addPlaneMember(distance);
}
Expand Down

0 comments on commit db29175

Please sign in to comment.