fix parse error when mpd is in stopped state due to the time field not being included v2.0
authorMike Frysinger <vapier@gentoo.org>
Sat, 24 Aug 2013 07:09:06 +0000 (03:09 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 24 Aug 2013 07:16:32 +0000 (03:16 -0400)
main.js
manifest.json

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];
 
index 14453b14eab89023310f47e9e49b343303f32b51..605208f5720a1ebab435a8a94ac6e7597223e87e 100644 (file)
@@ -2,7 +2,7 @@
   "manifest_version": 2,
   "minimum_chrome_version": "24",
   "name": "Music Player Client",
-  "version": "1.0.1",
+  "version": "2.0",
   "description": "Control a Music Player Daemon (MPD)",
   "icons": {
     "128": "images/icon-128x128.png"