Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Fix the bug of initial setup
Browse files Browse the repository at this point in the history
For the first time, load() will five null, which would cause the
NullPointerException
  • Loading branch information
tsszh committed Mar 22, 2016
1 parent 9f1efcb commit c8212ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ void setSlackBot(String slackToken, String userID) {
void connectToSlack(String token) {
this.session = SlackSessionFactory.createWebSocketSlackSession(token);
this.session.addMessagePostedListener(postedHangdler);
logger.info("Connecting to Slack Server ("+token+")...");;
try {
this.session.connect();
logger.info("Connection to SLack: Success - "+token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public void start() throws Exception {
bot = new SlackBot(); // Create the slackbot
(new Thread(bot)).start(); // Thread for slack bot server
load(); // Loads token & userID of this instance from the persisted storage.
if ( this.token == null ) this.token = "";
if ( this.userID == null ) this.userID = "";
resetSlackBot();
}
/**
Expand Down

0 comments on commit c8212ae

Please sign in to comment.