Description
Hi, Here is the error I occasionally encounter on a web IRC client running with the IRC framework:
TypeError: Cannot read properties of undefined (reading 'indexOf')
at Object.parseMask (/home/debian/node/.../server/libs/irc-framework-modded/src/helpers.js:20:23)
at Array.RPL_TOPICWHOTIME (/home/debian/node/.../server/libs/irc-framework-modded/src/commands/handlers/channel.js:198:32)
at IrcCommandHandler.executeCommand (/home/debian/node/.../server/libs/irc-framework-modded/src/commands/handler.js:65:40)
at IrcCommandHandler.dispatch (/home/debian/node/.../server/libs/irc-framework-modded/src/commands/handler.js:52:18)
at /home/debian/node/.../server/libs/irc-framework-modded/src/client.js:129:40
at next (/home/debian/node/.../server/libs/irc-framework-modded/node_modules/middleware-handler/index.js:42:18)
at MiddlewareHandler.handle (/home/debian/node/.../server/libs/irc-framework-modded/node_modules/middleware-handler/index.js:64:3)
at Connection. (/home/debian/node/.../server/libs/irc-framework-modded/src/client.js:123:35)
at Connection.emit (/home/debian/node/.../server/libs/irc-framework-modded/node_modules/eventemitter3/index.js:182:35)
at Connection.addReadBuffer (/home/debian/node/.../server/libs/irc-framework-modded/src/connection.js:167:14)
The client (server-side with the IRC framework) crashes. It doesn't happen often, on average about once a month.
About a month and a half ago, I updated to the latest version of the IRC framework. Just before that, for at least a solid year, here's how the code that causes the error was modified in helper.js. So, here's the original code:
const sep1 = mask.indexOf('!');
const sep2 = mask.indexOf('@');
To prevent it from crashing, I used to add this:
//const sep1 = mask.indexOf('!');
const sep1 = (mask || '').indexOf('!');
//const sep2 = mask.indexOf('@');
const sep2 = (mask || '').indexOf('@');
I've kept the original code since the last update.
I don't know how to reproduce the bug, nor how it happens.