fix SIGBUS
All checks were successful
/ Build BaseBand Loader (push) Successful in 2m24s

This commit is contained in:
Daniella / Tove 2024-10-14 03:51:45 +02:00
parent 1678e3af1d
commit 65c52cf1cc
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -392,9 +392,14 @@ public class Loader implements Util {
InputStream stream = urlStream; InputStream stream = urlStream;
if(filename != null) { if(filename != null) {
byte[] bytes = new StreamReader(stream).readAllAsBytes(); byte[] bytes = new StreamReader(stream).readAllAsBytes();
try(FileOutputStream os = new FileOutputStream(filename)) { try(FileOutputStream os = new FileOutputStream(filename + ".tmp")) {
os.write(bytes); os.write(bytes);
} catch (IOException ignored) { } } catch (IOException ignored) { }
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
File f = new File(filename);
f.delete();
new File(filename + ".tmp").renameTo(f);
}));
stream = new ByteArrayInputStream(bytes); stream = new ByteArrayInputStream(bytes);
} }
ZipInputStream jar = new ZipInputStream(stream); ZipInputStream jar = new ZipInputStream(stream);