Catch errors during preparation of client vars
... and disconnect the user
This commit is contained in:
parent
ccf4683558
commit
6689a3c02e
1 changed files with 11 additions and 5 deletions
|
@ -1006,11 +1006,17 @@ function handleClientReady(client, message)
|
||||||
//This is a normal first connect
|
//This is a normal first connect
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//prepare all values for the wire
|
//prepare all values for the wire, there'S a chance that this throws, if the pad is corrupted
|
||||||
|
try {
|
||||||
var atext = Changeset.cloneAText(pad.atext);
|
var atext = Changeset.cloneAText(pad.atext);
|
||||||
var attribsForWire = Changeset.prepareForWire(atext.attribs, pad.pool);
|
var attribsForWire = Changeset.prepareForWire(atext.attribs, pad.pool);
|
||||||
var apool = attribsForWire.pool.toJsonable();
|
var apool = attribsForWire.pool.toJsonable();
|
||||||
atext.attribs = attribsForWire.translated;
|
atext.attribs = attribsForWire.translated;
|
||||||
|
}catch(e) {
|
||||||
|
console.error(e.stack || e)
|
||||||
|
client.json.send({disconnect:"padCorrupted"});// pull the breaks
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
|
||||||
// Warning: never ever send padIds.padId to the client. If the
|
// Warning: never ever send padIds.padId to the client. If the
|
||||||
// client is read only you would open a security hole 1 swedish
|
// client is read only you would open a security hole 1 swedish
|
||||||
|
|
Loading…
Reference in a new issue