From dc285a63fedf302bcb559902dd30e5a0fcbf4531 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Mon, 14 Sep 2026 22:50:42 +0100 Subject: [PATCH] Implement host ID check in device state update method - Added a validation check in the `setDevicesState` method to ensure the host ID is present before proceeding with the device state update. - Introduced a warning log to notify when the host ID is not found, preventing unnecessary operations. --- src/socket/sockethost.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/socket/sockethost.js b/src/socket/sockethost.js index ef625eb..51fb095 100644 --- a/src/socket/sockethost.js +++ b/src/socket/sockethost.js @@ -266,6 +266,11 @@ export class SocketHost { async setDevicesState(state, online, connectedAt) { logger.info('Setting devices state to', state, 'and online to', online); + if (!this.host._id) { + logger.warn('Host not found. Skipping device state update.'); + return; + } + const documentPrinters = await listObjects({ model: getModelByName('documentPrinter'), filter: { host: this.host._id }