aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-05-24 08:14:59 -0700
committerScott Jackson <daneren2005@gmail.com>2013-05-24 08:14:59 -0700
commit28c9018fc928150a91299e90c1070aa2debb2955 (patch)
tree884c8120090441b9f029abf6bd58608da1bf5bb1 /subsonic-android/src
parent011a7e2ec6b0face64bcc8841ff5b8d3ad3db44f (diff)
downloaddsub-28c9018fc928150a91299e90c1070aa2debb2955.tar.gz
dsub-28c9018fc928150a91299e90c1070aa2debb2955.tar.bz2
dsub-28c9018fc928150a91299e90c1070aa2debb2955.zip
Fix if you set refresh rate to 0
Diffstat (limited to 'subsonic-android/src')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/ChatFragment.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/ChatFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/ChatFragment.java
index 38628fe8..4f373442 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/ChatFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/ChatFragment.java
@@ -124,14 +124,19 @@ public class ChatFragment extends SubsonicFragment {
SharedPreferences prefs = Util.getPreferences(context);
long refreshRate = Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_CHAT_REFRESH, "30"));
- executorService = Executors.newSingleThreadScheduledExecutor();
- executorService.scheduleWithFixedDelay(runnable, refreshRate * 1000L, refreshRate * 1000L, TimeUnit.MILLISECONDS);
+ if(refreshRate > 0) {
+ executorService = Executors.newSingleThreadScheduledExecutor();
+ executorService.scheduleWithFixedDelay(runnable, refreshRate * 1000L, refreshRate * 1000L, TimeUnit.MILLISECONDS);
+ }
}
@Override
public void onPause() {
super.onPause();
- executorService.shutdown();
+ if(executorService != null) {
+ executorService.shutdown();
+ executorService = null;
+ }
}
@Override