Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nil pointer dereference when TCP listener is configured
After 60526f6 (#31), `irccat.tcp.Run(irccat.irc)` is called (if the config calls for it) before, rather than after, `irccat.connectIRC()`, which changes `irccat.irc` away from a nil pointer in the first place. This pointer is copied into the `irc` field of a TCPListener `l` by `irccat.tcp.Run()`. A panic won't actually happen until the TCP listener handles its first message, if it ever comes, and in doing so passes the nil pointer further down to `dispatcher.Send(l.irc, ...)`. To fix, bring the call to `irccat.connectIRC()` forward again, to before any listener setup is done at all. This probably makes sense stylistically too.
- Loading branch information