From 3126531e3173f9dc5932476fb14bd656dbd47d0a Mon Sep 17 00:00:00 2001 From: rihi <19492038+rihi@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:32:33 +0100 Subject: [PATCH] Improve face hdr check --- src/main/java/info/ata4/bsplib/BspFileReader.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/info/ata4/bsplib/BspFileReader.java b/src/main/java/info/ata4/bsplib/BspFileReader.java index 1fa43e44..f8fadb88 100644 --- a/src/main/java/info/ata4/bsplib/BspFileReader.java +++ b/src/main/java/info/ata4/bsplib/BspFileReader.java @@ -204,11 +204,11 @@ public void loadFaces() { } // prioritize LUMP_FACES_HDR over LUMP_FACES - if (bspFile.getLump(LumpType.LUMP_FACES_HDR).getLength() != 0) - bspData.faces = readDStructChunksLump(LumpType.LUMP_FACES_HDR, this::faceDStructSupplier); - else - bspData.faces = readDStructChunksLump(LumpType.LUMP_FACES, this::faceDStructSupplier); + boolean useHdrLump = bspFile.canReadLump(LumpType.LUMP_FACES_HDR) + && bspFile.getLump(LumpType.LUMP_FACES_HDR).getLength() != 0; + LumpType faceLumpType = useHdrLump ? LumpType.LUMP_FACES_HDR : LumpType.LUMP_FACES; + bspData.faces = readDStructChunksLump(faceLumpType, this::faceDStructSupplier); L.fine(String.format("%d faces", bspData.faces.size())); }