Crash using VTX Client #284
* Fix try/catch around JSON.parse() * Ensure we don't try to replace on null/undefined no matter what
This commit is contained in:
parent
10ec5d4271
commit
5b20c3ec38
|
@ -249,11 +249,10 @@ exports.getModule = class MrcModule extends ServerModule {
|
|||
receiveFromClient(username, message) {
|
||||
try {
|
||||
message = JSON.parse(message);
|
||||
this.sendToMrcServer(message.from_user, message.from_room, message.to_user, message.to_site, message.to_room, message.body);
|
||||
} catch (e) {
|
||||
Log.debug({ server : 'MRC', user : username, message : message }, 'Dodgy message received from client');
|
||||
}
|
||||
|
||||
this.sendToMrcServer(message.from_user, message.from_room, message.to_user, message.to_site, message.to_room, message.body);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -264,11 +263,11 @@ exports.getModule = class MrcModule extends ServerModule {
|
|||
const line = [
|
||||
fromUser,
|
||||
this.boardName,
|
||||
sanitiseRoomName(fromRoom),
|
||||
sanitiseRoomName(fromRoom || ''),
|
||||
sanitiseName(toUser || ''),
|
||||
sanitiseName(toSite || ''),
|
||||
sanitiseRoomName(toRoom || ''),
|
||||
sanitiseMessage(messageBody)
|
||||
sanitiseMessage(messageBody || '')
|
||||
].join('~') + '~';
|
||||
|
||||
// Log.debug({ server : 'MRC', data : line }, 'Sending data');
|
||||
|
|
Loading…
Reference in New Issue