diff options
author | daneren2005 <daneren2005@gmail.com> | 2014-01-06 07:43:36 -0800 |
---|---|---|
committer | daneren2005 <daneren2005@gmail.com> | 2014-01-06 07:43:36 -0800 |
commit | c8710d5fcf60c5c2c237ea2a65a4895e770c11c1 (patch) | |
tree | 02e616b0a18906ad9fcb8f27a432577420103c8a /src | |
parent | f91d7473ce45f661ff2599841cf4464dd4973316 (diff) | |
parent | e6ae433f746a30b38312a0068566dbe290dc2a16 (diff) | |
download | dsub-c8710d5fcf60c5c2c237ea2a65a4895e770c11c1.tar.gz dsub-c8710d5fcf60c5c2c237ea2a65a4895e770c11c1.tar.bz2 dsub-c8710d5fcf60c5c2c237ea2a65a4895e770c11c1.zip |
Merge pull request #240 from smoak/t_fix_download_when_no_transcode_suffix
Fix NPE in download of file when song has no transcode suffix
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadFile.java | 15 |
1 files 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; } |