From a6b8ffa87733e6827c03f9becde5732b17ea6ddd Mon Sep 17 00:00:00 2001 From: Ash Keel Date: Sun, 19 Jun 2022 01:52:17 +0200 Subject: [PATCH] Fix twitch status poll crashing when twitch is not configured --- CHANGELOG.md | 1 + modules/twitch/client.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb9227c..7b1dab8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed `game` command not working when the specified channel contained the @ symbol at the beginning. - Fixed strimertul crashing at start if the database folder didn't exist and a database driver was not manually specified +- Fixed strimertul crashing after a minute of being open if Twitch was not configured. ## [2.1.1] - 2022-03-24 diff --git a/modules/twitch/client.go b/modules/twitch/client.go index cd59fd5..56d7222 100644 --- a/modules/twitch/client.go +++ b/modules/twitch/client.go @@ -143,6 +143,11 @@ func (c *Client) runStatusPoll() { // Wait for next poll time.Sleep(60 * time.Second) + // Make sure we're configured and connected properly first + if !c.Config.Enabled || c.Bot == nil || c.Bot.config.Channel == "" { + continue + } + // Check if streamer is online, if possible func() { status, err := c.API.GetStreams(&helix.StreamsParams{