Skip to content

Commit

Permalink
minor enhancements to net downloading and fix a possible crash
Browse files Browse the repository at this point in the history
  • Loading branch information
featurecat committed May 31, 2018
1 parent 788a76e commit 3b7ca3a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Binary file modified assets/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@
<artifactId>json</artifactId>
<version>20180130</version>
</dependency>

</dependencies>
</project>
5 changes: 3 additions & 2 deletions src/main/java/featurecat/lizzie/Lizzie.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void main(String[] args) throws IOException, JSONException, ClassN

public static void shutdown() {
PluginManager.onShutdown();
if (config.config.getJSONObject("ui").getBoolean("confirm-exit")) {
if (board != null && config.config.getJSONObject("ui").getBoolean("confirm-exit")) {
int ret = JOptionPane.showConfirmDialog(null, "Do you want to save this SGF?", "Save SGF?", JOptionPane.OK_CANCEL_OPTION);
if (ret == JOptionPane.OK_OPTION) {
LizzieFrame.saveSgf();
Expand All @@ -63,7 +63,8 @@ public static void shutdown() {
// Failed to save config
}

leelaz.shutdown();
if (leelaz != null)
leelaz.shutdown();
System.exit(0);
}

Expand Down
8 changes: 5 additions & 3 deletions src/main/java/featurecat/lizzie/analysis/Leelaz.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ public Leelaz() throws IOException, JSONException {
private void updateToLatestNetwork() {
try {
if (needToDownloadLatestNetwork()) {

Util.saveAsFile(new URL(baseURL + "/networks/" + getBestNetworkHash() + ".gz"),
new File(Lizzie.config.leelazConfig.getString("network-file")));
int dialogResult = JOptionPane.showConfirmDialog (null, "Download the latest network file? This may take some time.");
if(dialogResult == JOptionPane.YES_OPTION){
Util.saveAsFile(new URL(baseURL + "/networks/" + getBestNetworkHash() + ".gz"),
new File(Lizzie.config.leelazConfig.getString("network-file")));
}
}
} catch (IOException e) {
e.printStackTrace();
Expand Down

0 comments on commit 3b7ca3a

Please sign in to comment.