Skip to content

Commit d8c29d5

Browse files
fix: prevent crash when config is undefined in socket handler (#4096)
If a module uses this.io.of() to register a custom socket.io namespace, connections on that namespace trigger the onAny handler in setSocketIO before config is set, causing a TypeError. Fixes #4089
1 parent 9b97add commit d8c29d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

js/node_helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const NodeHelper = Class.extend({
8989
io.of(this.name).on("connection", (socket) => {
9090
// register catch all.
9191
socket.onAny((notification, payload) => {
92-
if (config.hideConfigSecrets && payload && typeof payload === "object") {
92+
if (config?.hideConfigSecrets && payload && typeof payload === "object") {
9393
try {
9494
const payloadStr = replaceSecretPlaceholder(JSON.stringify(payload));
9595
this.socketNotificationReceived(notification, JSON.parse(payloadStr));

0 commit comments

Comments
 (0)