Browse Source

Add missing crypto != nil checks

Tulir Asokan 5 years ago
parent
commit
b4949eec59
1 changed files with 6 additions and 2 deletions
  1. 6 2
      main.go

+ 6 - 2
main.go

@@ -254,7 +254,9 @@ func (bridge *Bridge) Start() {
 	bridge.Log.Debugln("Starting event processor")
 	go bridge.EventProcessor.Start()
 	go bridge.UpdateBotProfile()
-	go bridge.Crypto.Start()
+	if bridge.Crypto != nil {
+		go bridge.Crypto.Start()
+	}
 	go bridge.StartUsers()
 }
 
@@ -319,7 +321,9 @@ func (bridge *Bridge) StartUsers() {
 }
 
 func (bridge *Bridge) Stop() {
-	bridge.Crypto.Stop()
+	if bridge.Crypto != nil {
+		bridge.Crypto.Stop()
+	}
 	bridge.AS.Stop()
 	bridge.EventProcessor.Stop()
 	for _, user := range bridge.usersByJID {