diff --git a/src/itdelatrisu/opsu/downloads/DownloadNode.java b/src/itdelatrisu/opsu/downloads/DownloadNode.java index 36412ae3..302b740e 100644 --- a/src/itdelatrisu/opsu/downloads/DownloadNode.java +++ b/src/itdelatrisu/opsu/downloads/DownloadNode.java @@ -248,7 +248,7 @@ public void createDownload(DownloadServer server) { return; String path = String.format("%s%c%d", Options.getOSZDir(), File.separatorChar, beatmapSetID); String rename = String.format("%d %s - %s.osz", beatmapSetID, artist, title); - this.download = new Download(url, path, rename); + Download download = new Download(url, path, rename); download.setListener(new DownloadListener() { @Override public void completed() { @@ -260,6 +260,7 @@ public void error() { UI.sendBarNotification("Download failed due to a connection error."); } }); + this.download = download; if (Options.useUnicodeMetadata()) // load glyphs Utils.loadGlyphs(Utils.FONT_LARGE, getTitle(), null); } @@ -372,6 +373,7 @@ public void drawResult(Graphics g, int index, boolean hover, boolean focus, bool * @param hover true if the mouse is hovering over this button */ public void drawDownload(Graphics g, int index, int id, boolean hover) { + Download download = this.download; // in case clearDownload() is called asynchronously if (download == null) { ErrorHandler.error("Trying to draw download information for button without Download object.", null, false); return;