Fixed launcherBinary NPE.

This commit is contained in:
zaxar163 2019-01-08 17:57:01 +04:00
parent 5ba69c155a
commit 78def447ce
No known key found for this signature in database
GPG key ID: CEE900027AE098E0
4 changed files with 10 additions and 7 deletions

View file

@ -460,6 +460,9 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE
// Set launcher EXE binary
launcherBinary = new JARLauncherBinary(this);
launcherEXEBinary = binary();
launcherBinary.init();
launcherEXEBinary.init();
syncLauncherBinaries();
// Sync updates dir

View file

@ -41,7 +41,6 @@ public void clear() {
public EXEL4JLauncherBinary(LaunchServer server) {
super(server, server.dir.resolve(server.config.binaryName + ".exe"));
faviconFile = server.dir.resolve("favicon.ico");
//setConfig();
}
@Override

View file

@ -32,12 +32,16 @@ public JARLauncherBinary(LaunchServer server) throws IOException {
guardDir = server.dir.resolve(Launcher.GUARD_DIR);
buildDir = server.dir.resolve("build");
tasks = new ArrayList<>();
}
@Override
public void init() {
tasks.add(new UnpackBuildTask(server));
tasks.add(new MainBuildTask(server));
if(server.config.enabledProGuard) tasks.add(new ProGuardBuildTask(server));
if(server.config.stripLineNumbers) tasks.add(new StripLineNumbersTask(server));
}
@Override
public void build() throws IOException {
LogHelper.info("Building launcher binary file");

View file

@ -9,25 +9,20 @@
import ru.gravit.utils.helper.SecurityHelper;
public abstract class LauncherBinary {
public final LaunchServer server;
public Path syncBinaryFile;
private volatile DigestBytesHolder binary;
private volatile byte[] sign;
protected LauncherBinary(LaunchServer server, Path binaryFile) {
this.server = server;
syncBinaryFile = binaryFile;
}
protected LauncherBinary(LaunchServer server) {
this.server = server;
}
public abstract void build() throws IOException;
@ -44,6 +39,8 @@ public final byte[] getSign() {
return sign;
}
public void init() {
}
public final boolean sync() throws IOException {
boolean exists = exists();