Gson isn't broken, I'm broken

This commit is contained in:
comp500 2019-06-24 03:41:33 +01:00
parent d18e134140
commit 533c7a3ed5
No known key found for this signature in database
GPG Key ID: 214C822FFEC586B5

View File

@ -110,18 +110,16 @@ public class UpdateManager {
ui.submitProgress(new InstallProgress("Loading manifest file...")); ui.submitProgress(new InstallProgress("Loading manifest file..."));
Gson gson = new Gson(); Gson gson = new Gson();
ManifestFile manifest = null; ManifestFile manifest;
try { try {
manifest = gson.fromJson(new FileReader(Paths.get(opts.packFolder, opts.manifestFile).toString()), manifest = gson.fromJson(new FileReader(Paths.get(opts.packFolder, opts.manifestFile).toString()),
ManifestFile.class); ManifestFile.class);
} catch (FileNotFoundException e) { // Do nothing } catch (FileNotFoundException e) {
manifest = new ManifestFile();
} catch (JsonSyntaxException | JsonIOException e) { } catch (JsonSyntaxException | JsonIOException e) {
ui.handleExceptionAndExit(e); ui.handleExceptionAndExit(e);
return; return;
} }
if (manifest == null) {
manifest = new ManifestFile();
}
ui.submitProgress(new InstallProgress("Loading pack file...")); ui.submitProgress(new InstallProgress("Loading pack file..."));
GeneralHashingSource packFileSource; GeneralHashingSource packFileSource;
@ -142,7 +140,7 @@ public class UpdateManager {
return; return;
} }
if (packFileSource.hashIsEqual(manifest.packFileHash)) { if (manifest.packFileHash != null && packFileSource.hashIsEqual(manifest.packFileHash)) {
System.out.println("Hash already up to date!"); System.out.println("Hash already up to date!");
// WOOO it's already up to date // WOOO it's already up to date
// todo: --force? // todo: --force?