Skip to content

Commit

Permalink
Fixed a "panic: runtime error: invalid memory address or nil pointer …
Browse files Browse the repository at this point in the history
…dereference" when we are running in debug mode and try to load the configuration from twitter
  • Loading branch information
andygrunwald committed Dec 23, 2016
1 parent 7673a01 commit c6bb65e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c6bb65e

Please sign in to comment.