From 84f1623a48f57d05eb574898e15e159cf9b1e66b Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 23 Mar 2015 08:32:18 -0700 Subject: Fix divide by 0 --- src/github/daneren2005/dsub/provider/DLNARouteProvider.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/github/daneren2005') 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 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) -- cgit v1.2.3