aboutsummaryrefslogtreecommitdiff
path: root/webAO
diff options
context:
space:
mode:
authorsD <stoned@derpymail.org>2020-04-02 12:07:07 +0200
committersD <stoned@derpymail.org>2020-04-02 12:07:07 +0200
commitf87f98d1e265bf205579b69c41e5df5f3267a625 (patch)
treeda70e28bc2f59ce2d3b698dc051805b9501c35cf /webAO
parent8e18260349e57aaed9fd6a4ce77876f0f1423a14 (diff)
if we don't know the name display a generic message
Diffstat (limited to 'webAO')
-rw-r--r--webAO/client.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/webAO/client.js b/webAO/client.js
index 84b7b87..d9eb830 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -604,8 +604,9 @@ class Client extends EventEmitter {
*/
handleMC(args) {
const track = args[1];
- const charID = Number(args[2]);
+ let charID = Number(args[2]);
const music = viewport.music;
+ let musicname;
music.pause();
if(track.startsWith("http")) {
music.src = track;
@@ -613,6 +614,13 @@ class Client extends EventEmitter {
music.src = MUSIC_HOST + track.toLowerCase();
}
music.play();
+
+ try {
+ musicname = this.chars[charID].name;
+ } catch(e) {
+ charID = -1;
+ }
+
if (charID >= 0) {
const musicname = this.chars[charID].name;
appendICLog(`${musicname} changed music to ${track}`);
@@ -657,7 +665,7 @@ class Client extends EventEmitter {
} catch (err) {
cini = {};
img.classList.add("noini");
- console.warn("character " + chargs[0] + " is missing from webAO")
+ console.warn("character " + chargs[0] + " is missing from webAO");
// If it does, give the user a visual indication that the character is unusable
}