Skip to content

Commit a857973

Browse files
authored
add a states guard to send to for shutdown processes (#2910)
1 parent 2202d94 commit a857973

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/controller/src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,10 @@ async function sendTo(
18461846
message: ioBroker.MessagePayload,
18471847
callback?: ioBroker.ErrorCallback | ioBroker.MessageCallbackInfo
18481848
): Promise<void> {
1849+
if (!states) {
1850+
return;
1851+
}
1852+
18491853
if (message === undefined) {
18501854
message = command;
18511855
command = 'send';
@@ -1876,7 +1880,7 @@ async function sendTo(
18761880
}
18771881
}
18781882
try {
1879-
await states!.pushMessage(objName, obj);
1883+
await states.pushMessage(objName, obj);
18801884
} catch (e) {
18811885
// do not stringify the object, we had the issue with the invalid string length on serialization
18821886
logger.error(

0 commit comments

Comments
 (0)