mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-31 20:59:54 +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 {
|
public final boolean sync() throws IOException {
|
||||||
boolean exists = exists();
|
boolean exists = exists();
|
||||||
if (sign != null)
|
CommonHelper.removeExc(sign);
|
||||||
CommonHelper.removeExc(sign);
|
|
||||||
if (binary != null) {
|
if (binary != null) {
|
||||||
CommonHelper.removeExc(binary.getBytes());
|
CommonHelper.removeExc(binary.getBytes());
|
||||||
CommonHelper.removeExc(binary.getDigest());
|
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;
|
binary = exists ? new DigestBytesHolder(IOHelper.read(syncBinaryFile), SecurityHelper.DigestAlgorithm.SHA512) : null;
|
||||||
sign = exists ? SecurityHelper.sign(IOHelper.read(syncBinaryFile), server.privateKey) : null;
|
sign = exists ? SecurityHelper.sign(IOHelper.read(syncBinaryFile), server.privateKey) : null;
|
||||||
CommonHelper.addExc(sign);
|
CommonHelper.addExc(sign);
|
||||||
CommonHelper.addExc(binary.getBytes());
|
if (binary != null) {
|
||||||
CommonHelper.addExc(binary.getDigest());
|
CommonHelper.addExc(binary.getBytes());
|
||||||
return exists;
|
CommonHelper.addExc(binary.getDigest());
|
||||||
|
}
|
||||||
|
return exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Path resolve(LaunchServer server, String ext) {
|
public static Path resolve(LaunchServer server, String ext) {
|
||||||
|
|
|
@ -143,12 +143,14 @@ public static GsonBuilder newBuilder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addExc(byte[] exclusion) {
|
public static void addExc(byte[] exclusion) {
|
||||||
|
if (exclusion == null) return;
|
||||||
JsonArray add = new JsonArray(exclusion.length);
|
JsonArray add = new JsonArray(exclusion.length);
|
||||||
for (byte b : exclusion) add.add(new JsonPrimitive(b));
|
for (byte b : exclusion) add.add(new JsonPrimitive(b));
|
||||||
ByteArrayToBase64TypeAdapter.exclusions.put(exclusion, add);
|
ByteArrayToBase64TypeAdapter.exclusions.put(exclusion, add);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeExc(byte[] exclusion) {
|
public static void removeExc(byte[] exclusion) {
|
||||||
|
if (exclusion == null) return;
|
||||||
ByteArrayToBase64TypeAdapter.exclusions.remove(exclusion);
|
ByteArrayToBase64TypeAdapter.exclusions.remove(exclusion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue