fix qmp hang if return is empty

This commit is contained in:
elijahr2411
2023-02-07 21:43:45 -05:00
parent b1f0eb7425
commit 6419604aa6

View File

@@ -42,14 +42,14 @@ export default class QMPClient extends EventEmitter {
var msg;
try {msg = JSON.parse(msgraw);}
catch {return;}
if (msg.QMP) {
if (msg.QMP !== undefined) {
if (this.sentConnected) {return;};
await this.execute({ execute: "qmp_capabilities" });
this.emit('connected');
this.sentConnected = true;
}
if (msg.return) this.emit("qmpreturn", msg.return);
if (msg.return !== undefined) this.emit("qmpreturn", msg.return);
}
private onClose() {