mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] NPE при запуске LaunchServer`а.
This commit is contained in:
parent
408da409df
commit
d1132806da
2 changed files with 8 additions and 5 deletions
|
@ -41,8 +41,7 @@ public void init() {
|
|||
|
||||
public final boolean sync() throws IOException {
|
||||
boolean exists = exists();
|
||||
if (sign != null)
|
||||
CommonHelper.removeExc(sign);
|
||||
CommonHelper.removeExc(sign);
|
||||
if (binary != null) {
|
||||
CommonHelper.removeExc(binary.getBytes());
|
||||
CommonHelper.removeExc(binary.getDigest());
|
||||
|
@ -50,9 +49,11 @@ public final boolean sync() throws IOException {
|
|||
binary = exists ? new DigestBytesHolder(IOHelper.read(syncBinaryFile), SecurityHelper.DigestAlgorithm.SHA512) : null;
|
||||
sign = exists ? SecurityHelper.sign(IOHelper.read(syncBinaryFile), server.privateKey) : null;
|
||||
CommonHelper.addExc(sign);
|
||||
CommonHelper.addExc(binary.getBytes());
|
||||
CommonHelper.addExc(binary.getDigest());
|
||||
return exists;
|
||||
if (binary != null) {
|
||||
CommonHelper.addExc(binary.getBytes());
|
||||
CommonHelper.addExc(binary.getDigest());
|
||||
}
|
||||
return exists;
|
||||
}
|
||||
|
||||
public static Path resolve(LaunchServer server, String ext) {
|
||||
|
|
|
@ -143,12 +143,14 @@ public static GsonBuilder newBuilder() {
|
|||
}
|
||||
|
||||
public static void addExc(byte[] exclusion) {
|
||||
if (exclusion == null) return;
|
||||
JsonArray add = new JsonArray(exclusion.length);
|
||||
for (byte b : exclusion) add.add(new JsonPrimitive(b));
|
||||
ByteArrayToBase64TypeAdapter.exclusions.put(exclusion, add);
|
||||
}
|
||||
|
||||
public static void removeExc(byte[] exclusion) {
|
||||
if (exclusion == null) return;
|
||||
ByteArrayToBase64TypeAdapter.exclusions.remove(exclusion);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue