From 587fc0cda73fd7482a65e2c28a62adb55e7ad539 Mon Sep 17 00:00:00 2001 From: rihi <19492038+rihi@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:58:31 +0200 Subject: [PATCH] Fix ArrayIndexOutOfBoundsException #192 --- .../info/ata4/bspsrc/decompiler/util/OccluderMapper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bspsrc-decompiler/src/main/java/info/ata4/bspsrc/decompiler/util/OccluderMapper.java b/bspsrc-decompiler/src/main/java/info/ata4/bspsrc/decompiler/util/OccluderMapper.java index ac46728d..8c5d17eb 100644 --- a/bspsrc-decompiler/src/main/java/info/ata4/bspsrc/decompiler/util/OccluderMapper.java +++ b/bspsrc-decompiler/src/main/java/info/ata4/bspsrc/decompiler/util/OccluderMapper.java @@ -73,7 +73,11 @@ private static ReallocationData manualMapping( Arrays.parallelPrefix(brushSideIndices, Integer::sum); var scores = createScores(bsp, windingFactory, occluderPolyIndices, brushSideIndices, firstNonWorldIBrush); - var mappingResult = hungarian((j, w) -> scores[j][w], scores.length, scores[0].length); + var mappingResult = hungarian( + (j, w) -> scores[j][w], + occluderPolyIndices.length > 0 ? occluderPolyIndices[occluderPolyIndices.length - 1] : 0, + brushSideIndices.length > 0 ? brushSideIndices[brushSideIndices.length - 1] : 0 + ); var collectBrushes = collectBrushes(bsp, mappingResult, scores, occluderPolyIndices, brushSideIndices, firstNonWorldIBrush);