X-Git-Url: https://git.wh0rd.org/?p=chrome-ext%2Fmusic-player-client.git;a=blobdiff_plain;f=main.js;h=266bb1e60f6b242ff3108ae858d3d9322281f9b2;hp=1466bded59d7192b0a094b2c4bea70254d47cb39;hb=59f1734f1a863c8082c2a65b5f479cb6aea9651c;hpb=650b9e7b55fa66426318c67b20f6c0cf82faac27 diff --git a/main.js b/main.js index 1466bde..266bb1e 100644 --- a/main.js +++ b/main.js @@ -157,12 +157,15 @@ function show_page(page) { if (typeof(page) != 'string') page = this.id.split('.')[1]; + // We might not be connected in which case 'mpc' will be undefined. switch (page) { case 'playlist': - mpc.playlistinfo(); + if (mpc) + mpc.playlistinfo(); // Fallthrough. case 'metadata': - mpc.currentsong(); + if (mpc) + mpc.currentsong(); break; }