From c6bb65ece72957295f3de9b42bc9d7049a9bc0bc Mon Sep 17 00:00:00 2001 From: Andy Grunwald Date: Fri, 23 Dec 2016 19:10:53 +0100 Subject: [PATCH] Fixed a "panic: runtime error: invalid memory address or nil pointer dereference" when we are running in debug mode and try to load the configuration from twitter --- main.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index ee07c02..4e71f22 100644 --- a/main.go +++ b/main.go @@ -51,9 +51,14 @@ func main() { // Prepare the twitter client twitterClient := twitter.NewClient(*twitterConsumerKey, *twitterConsumerSecret, *twitterAccessToken, *twitterAccessTokenSecret, *debugMode) - err := twitterClient.LoadConfiguration() - if err != nil { - log.Fatalf("Twitter Configuration initialisation failed: %s", err) + + // When we are running in a debug mode, we are running with a debug configuration. + // So we don`t need to load the configuration from twitter here. + if *debugMode == false { + err := twitterClient.LoadConfiguration() + if err != nil { + log.Fatalf("Twitter Configuration initialisation failed: %s", err) + } } twitterClient.SetupConfigurationRefresh(configurationRefreshTime)