@@ -47,22 +47,23 @@ internal fun decode(
4747
4848 val groups = hashMapOf<Int , Group >()
4949 (0 until count).forEach {
50- val groupReferenceTableData = datFile.readReferenceTable(idxFile.id(), idxFile.loadReferenceTable(it))
50+ val groupId = groupIds[it]
51+
52+ val groupReferenceTableData = datFile.readReferenceTable(idxFile.id(), idxFile.loadReferenceTable(groupId))
5153 val data = if (groupReferenceTableData.isEmpty()) byteArrayOf() else try {
5254 groupReferenceTableData.decompress()
5355 } catch (exception: ZipException ) {
5456 groupReferenceTableData
5557 }
5658
57- val groupId = groupIds[it]
58- groups[it] = (Group (
59+ groups[groupId] = (Group (
5960 groupId,
6061 groupNameHashes[groupId],
6162 groupCrcs[groupId],
6263 groupWhirlpools[groupId],
6364 groupRevisions[groupId],
6465 intArrayOf(),// TODO
65- decodeFiles(fileIds, fileNameHashes, data, groupFileIds[it ], it ),
66+ decodeFiles(fileIds, fileNameHashes, data, groupFileIds[groupId ], groupId ),
6667 data
6768 ))
6869 }
@@ -206,7 +207,7 @@ internal fun decodeFiles(
206207 groupId : Int
207208): Map <Int , File > {
208209 if (data.isEmpty()) return hashMapOf(Pair (0 , File .DEFAULT ))
209- if (count = = 1 ) return hashMapOf(Pair (0 , File (fileIds[groupId][0 ], fileNameHashes[groupId][0 ], data)))
210+ if (count < = 1 ) return hashMapOf(Pair (0 , File (fileIds[groupId][0 ], fileNameHashes[groupId][0 ], data)))
210211
211212 var position = data.size
212213 val chunks = data[-- position].toInt() and 0xFF
0 commit comments