]> git.wh0rd.org - chrome-ext/music-player-client.git/blobdiff - main.js
fix parse error when mpd is in stopped state due to the time field not being included
[chrome-ext/music-player-client.git] / main.js
diff --git a/main.js b/main.js
index 7e12e9fe4948b04d5d10b512e84475bd252753d8..1e83a3b2b6c0b996f34e4b30e12478ccea15554d 100644 (file)
--- a/main.js
+++ b/main.js
@@ -239,7 +239,12 @@ function update_ui(state, cmd) {
                return;
        }
 
-       var time = state.time.split(':');
+       var time;
+       if ('time' in state)
+               // When stopped, there is no time field at all.
+               time = state.time.split(':');
+       else
+               time = [0, 0];
        window['ui_mpc_seekcur'].max = time[1];
        window['ui_mpc_seekcur'].value = time[0];