From 99f76e3227a2c90874929da703b108f47b14844f Mon Sep 17 00:00:00 2001 From: Nyo Date: Fri, 7 Oct 2016 13:43:47 +0200 Subject: [PATCH] .BANCHO. .FIX. Fix None token in cantSpectateEvent --- events/cantSpectateEvent.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/events/cantSpectateEvent.py b/events/cantSpectateEvent.py index b43550e..86486e8 100644 --- a/events/cantSpectateEvent.py +++ b/events/cantSpectateEvent.py @@ -5,16 +5,13 @@ from objects import glob def handle(userToken, _): - # get usertoken data - userID = userToken.userID - try: # We don't have the beatmap, we can't spectate - target = userToken.spectating - targetToken = glob.tokens.getTokenFromUserID(target) + if userToken.spectating not in glob.tokens.tokens: + raise exceptions.tokenNotFoundException # Send the packet to host - targetToken.enqueue(serverPackets.noSongSpectator(userID)) + glob.tokens.tokens[userToken.spectating].enqueue(serverPackets.noSongSpectator(userToken.userID)) except exceptions.tokenNotFoundException: # Stop spectating if token not found log.warning("Spectator can't spectate: token not found")