Fix disconnect crash when screen doesn't exist
The function removeChild throws an exception when the element specified doesn't exist. This can happen when opening the websocket throws an exception during connect. Fixes issue #979
This commit is contained in:
parent
7f1049c0ee
commit
b245ec7038
|
@ -433,7 +433,16 @@ RFB.prototype = {
|
|||
this._mouse.ungrab();
|
||||
this._sock.close();
|
||||
this._print_stats();
|
||||
try {
|
||||
this._target.removeChild(this._screen);
|
||||
} catch (e) {
|
||||
if (e.name === 'NotFoundError') {
|
||||
// Some cases where the initial connection fails
|
||||
// can disconnect before the _screen is created
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
clearTimeout(this._resizeTimeout);
|
||||
Log.Debug("<< RFB.disconnect");
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue