Skip to content

Commit

Permalink
add a states guard to send to for shutdown processes
Browse files Browse the repository at this point in the history
  • Loading branch information
foxriver76 committed Sep 13, 2024
1 parent 9a3639a commit 8235157
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/controller/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1846,6 +1846,10 @@ async function sendTo(
message: ioBroker.MessagePayload,
callback?: ioBroker.ErrorCallback | ioBroker.MessageCallbackInfo
): Promise<void> {
if (!states) {
return;
}

if (message === undefined) {
message = command;
command = 'send';
Expand Down Expand Up @@ -1876,7 +1880,7 @@ async function sendTo(
}
}
try {
await states!.pushMessage(objName, obj);
await states.pushMessage(objName, obj);
} catch (e) {
// do not stringify the object, we had the issue with the invalid string length on serialization
logger.error(
Expand Down

0 comments on commit 8235157

Please sign in to comment.