Attempted fix for a null pointer exception in #123.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
96f882bd99
commit
8efcc1f2ee
|
@ -248,7 +248,7 @@ public class DownloadNode {
|
|||
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 class DownloadNode {
|
|||
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 class DownloadNode {
|
|||
* @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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user