]> git.lizzy.rs Git - go-anidb.git/commitdiff
anidb: Always remove credentials on Logout()
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Mon, 15 Jul 2013 04:25:55 +0000 (01:25 -0300)
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Mon, 15 Jul 2013 04:25:55 +0000 (01:25 -0300)
Even if they were never used.

auth.go

diff --git a/auth.go b/auth.go
index de355f1ed8365af80cc5457b76c1d2a5a3f1f4fc..a4058a9854643e30e1ac2f27b06b3218a5a0499d 100644 (file)
--- a/auth.go
+++ b/auth.go
@@ -119,10 +119,10 @@ func (adb *AniDB) Auth(username, password, udpKey string) (err error) {
 
 // Logs the user out and removes the credentials from the AniDB struct.
 func (adb *AniDB) Logout() error {
-       if adb.udp.connected {
-               adb.udp.credentials.shred()
-               adb.udp.credentials = nil
+       adb.udp.credentials.shred()
+       adb.udp.credentials = nil
 
+       if adb.udp.connected {
                adb.udp.connected = false
                return adb.udp.Logout()
        }