Skip to content

Commit d481a1e

Browse files
authored
Add checking that arguments to be sent is actually an object (#226)
Fixes hanging because the malformed message sent doesn't send a message ID to obs-websocket.
1 parent ac70bbc commit d481a1e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/OBSWebSocket.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class OBSWebSocket extends Socket {
2929
rejectReason = Status.REQUEST_TYPE_NOT_SPECIFIED;
3030
}
3131

32+
if (args && (typeof args !== 'object' || args === null || Array.isArray(args))) {
33+
rejectReason = Status.ARGS_NOT_OBJECT;
34+
}
35+
3236
if (!this._connected) {
3337
rejectReason = Status.NOT_CONNECTED;
3438
}

lib/Status.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ module.exports = {
1919
status: 'error',
2020
description: 'A Request Type was not specified.'
2121
},
22+
ARGS_NOT_OBJECT: {
23+
status: 'error',
24+
description: 'The supplied argments parameter is not an object.'
25+
},
2226

2327
init() {
2428
for (const key in this) {

0 commit comments

Comments
 (0)