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;
|
return;
|
||||||
String path = String.format("%s%c%d", Options.getOSZDir(), File.separatorChar, beatmapSetID);
|
String path = String.format("%s%c%d", Options.getOSZDir(), File.separatorChar, beatmapSetID);
|
||||||
String rename = String.format("%d %s - %s.osz", beatmapSetID, artist, title);
|
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() {
|
download.setListener(new DownloadListener() {
|
||||||
@Override
|
@Override
|
||||||
public void completed() {
|
public void completed() {
|
||||||
|
@ -260,6 +260,7 @@ public class DownloadNode {
|
||||||
UI.sendBarNotification("Download failed due to a connection error.");
|
UI.sendBarNotification("Download failed due to a connection error.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.download = download;
|
||||||
if (Options.useUnicodeMetadata()) // load glyphs
|
if (Options.useUnicodeMetadata()) // load glyphs
|
||||||
Utils.loadGlyphs(Utils.FONT_LARGE, getTitle(), null);
|
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
|
* @param hover true if the mouse is hovering over this button
|
||||||
*/
|
*/
|
||||||
public void drawDownload(Graphics g, int index, int id, boolean hover) {
|
public void drawDownload(Graphics g, int index, int id, boolean hover) {
|
||||||
|
Download download = this.download; // in case clearDownload() is called asynchronously
|
||||||
if (download == null) {
|
if (download == null) {
|
||||||
ErrorHandler.error("Trying to draw download information for button without Download object.", null, false);
|
ErrorHandler.error("Trying to draw download information for button without Download object.", null, false);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user