diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-03-23 08:32:18 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-03-23 08:32:18 -0700 |
commit | 84f1623a48f57d05eb574898e15e159cf9b1e66b (patch) | |
tree | 6114e358c3812006b3f228ae4ec52a9c672c6c05 | |
parent | ec406498c9f6d2b897707da48da5dd46ec85cfc4 (diff) | |
download | dsub-84f1623a48f57d05eb574898e15e159cf9b1e66b.tar.gz dsub-84f1623a48f57d05eb574898e15e159cf9b1e66b.tar.bz2 dsub-84f1623a48f57d05eb574898e15e159cf9b1e66b.zip |
Fix divide by 0
-rw-r--r-- | src/github/daneren2005/dsub/provider/DLNARouteProvider.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/provider/DLNARouteProvider.java b/src/github/daneren2005/dsub/provider/DLNARouteProvider.java index 54c9ffb5..73d4b5de 100644 --- a/src/github/daneren2005/dsub/provider/DLNARouteProvider.java +++ b/src/github/daneren2005/dsub/provider/DLNARouteProvider.java @@ -165,9 +165,14 @@ public class DLNARouteProvider extends MediaRouteProvider { for(Map.Entry<String, DLNADevice> deviceEntry: devices.entrySet()) { DLNADevice device = deviceEntry.getValue(); - int increments = device.volumeMax / 10; - int volume = controller == null ? device.volume : (int) controller.getVolume(); - volume = volume / increments; + int volume; + if(device.volumeMax == 0) { + volume = 5; + } else { + int increments = device.volumeMax / 10; + volume = controller == null ? device.volume : (int) controller.getVolume(); + volume = volume / increments; + } MediaRouteDescriptor.Builder routeBuilder = new MediaRouteDescriptor.Builder(device.id, device.name); routeBuilder.addControlFilter(routeIntentFilter) |