From e6ae433f746a30b38312a0068566dbe290dc2a16 Mon Sep 17 00:00:00 2001 From: Scott Moak Date: Sun, 5 Jan 2014 20:57:01 -0800 Subject: Fix NPE in download of file when song has no transcode suffix --- src/github/daneren2005/dsub/service/DownloadFile.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/github/daneren2005/dsub/service/DownloadFile.java b/src/github/daneren2005/dsub/service/DownloadFile.java index c3758b01..f0b3d802 100644 --- a/src/github/daneren2005/dsub/service/DownloadFile.java +++ b/src/github/daneren2005/dsub/service/DownloadFile.java @@ -95,13 +95,14 @@ public class DownloadFile { } private int getActualBitrate() { int br = song.isVideo() ? Util.getMaxVideoBitrate(context) : Util.getMaxBitrate(context); - if(br == 0 && "mp3".equals(song.getTranscodedSuffix().toLowerCase())) { - if(song.getBitRate() != null) { - br = Math.min(320, song.getBitRate()); - } else { - br = 320; - } - } + if (br == 0 && song.getTranscodedSuffix() != null && + "mp3".equals(song.getTranscodedSuffix().toLowerCase()) && + song.getBitRate() != null) { + br = Math.min(320, song.getBitRate()); + } else { + br = 320; + } + return br; } -- cgit v1.2.3