fix crash on Java 8 (#1954)

This commit is contained in:
Glavo
2022-12-30 17:21:57 +08:00
committed by GitHub
parent 0f0f5cbc28
commit 2b4e476153

View File

@@ -19,6 +19,7 @@ package org.jackhuang.hmcl.upgrade;
import java.io.IOException;
import java.io.InputStream;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
@@ -75,7 +76,7 @@ final class ExecutableHeaderHelper {
suffixLoop: for (String suffix : suffix2header.keySet()) {
Optional<byte[]> header = readHeader(zip, suffix);
if (header.isPresent()) {
buf.rewind();
((Buffer) buf).rewind();
for (byte b : header.get()) {
if (!buf.hasRemaining() || b != buf.get()) {
continue suffixLoop;