From 8770929246b35cfbd032e3a5a8c25a473dd6da07 Mon Sep 17 00:00:00 2001 From: Flechaa <50523969+Flechaa@users.noreply.github.com> Date: Wed, 27 Nov 2024 02:11:14 +0000 Subject: [PATCH 1/2] Fix crash caused by invalid json after device init --- .../src/lib/deviceControlConnection.ts | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/packages/connections/src/lib/deviceControlConnection.ts b/packages/connections/src/lib/deviceControlConnection.ts index fcab138..77166bc 100644 --- a/packages/connections/src/lib/deviceControlConnection.ts +++ b/packages/connections/src/lib/deviceControlConnection.ts @@ -78,40 +78,44 @@ export class DeviceControlConnection extends EventEmitter { received(message: string) { this.log.debug(`${this.deviceId}: Date: Wed, 27 Nov 2024 02:13:45 +0000 Subject: [PATCH 2/2] Fix crash caused by invalid command body in getMemoryUsage --- packages/connections/src/lib/deviceControlConnection.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/connections/src/lib/deviceControlConnection.ts b/packages/connections/src/lib/deviceControlConnection.ts index 77166bc..19a94d1 100644 --- a/packages/connections/src/lib/deviceControlConnection.ts +++ b/packages/connections/src/lib/deviceControlConnection.ts @@ -161,7 +161,9 @@ export class DeviceControlConnection extends EventEmitter { //< {"id":7,"status":200,"body":{"memFree":123, ...}} const memory = await this.executeCommand('getMemoryUsage', null, 5000); - this.lastMemory = memory; // spy on result + if (typeof memory === 'object') { + this.lastMemory = memory; // spy on result + } return memory; }