From 533c7a3ed59c251290d0069f0ce7ec7b204c62ab Mon Sep 17 00:00:00 2001 From: comp500 Date: Mon, 24 Jun 2019 03:41:33 +0100 Subject: [PATCH] Gson isn't broken, I'm broken --- .../link/infra/packwiz/installer/UpdateManager.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/link/infra/packwiz/installer/UpdateManager.java b/src/main/java/link/infra/packwiz/installer/UpdateManager.java index a61271f..1814449 100644 --- a/src/main/java/link/infra/packwiz/installer/UpdateManager.java +++ b/src/main/java/link/infra/packwiz/installer/UpdateManager.java @@ -110,18 +110,16 @@ protected void start() { ui.submitProgress(new InstallProgress("Loading manifest file...")); Gson gson = new Gson(); - ManifestFile manifest = null; + ManifestFile manifest; try { manifest = gson.fromJson(new FileReader(Paths.get(opts.packFolder, opts.manifestFile).toString()), ManifestFile.class); - } catch (FileNotFoundException e) { // Do nothing + } catch (FileNotFoundException e) { + manifest = new ManifestFile(); } catch (JsonSyntaxException | JsonIOException e) { ui.handleExceptionAndExit(e); return; } - if (manifest == null) { - manifest = new ManifestFile(); - } ui.submitProgress(new InstallProgress("Loading pack file...")); GeneralHashingSource packFileSource; @@ -142,7 +140,7 @@ protected void start() { return; } - if (packFileSource.hashIsEqual(manifest.packFileHash)) { + if (manifest.packFileHash != null && packFileSource.hashIsEqual(manifest.packFileHash)) { System.out.println("Hash already up to date!"); // WOOO it's already up to date // todo: --force?