Fix viewer crashing when a message references a channel/user that is not saved (app)

Closes #148
This commit is contained in:
chylex 2021-08-15 20:00:15 +02:00
parent 6a24befca1
commit bd78051a9d
No known key found for this signature in database
GPG Key ID: 4DE42C8F19A80548

View File

@ -317,15 +317,18 @@ const STATE = (function() {
},
getChannelName(channel) {
return loadedFileMeta.channels[channel].name || channel;
const channelObj = loadedFileMeta.channels[channel];
return (channelObj && channelObj.name) || channel;
},
getUserTag(user) {
return loadedFileMeta.users[user].tag;
const userObj = loadedFileMeta.users[user];
return (userObj && userObj.tag) || "????";
},
getUserName(user) {
return loadedFileMeta.users[user].name || user;
const userObj = loadedFileMeta.users[user];
return (userObj && userObj.name) || user;
},
selectChannel(channel) {