.BANCHO. .FIX. Fix None token in cantSpectateEvent

This commit is contained in:
Nyo 2016-10-07 13:43:47 +02:00
parent ea83d3c86d
commit 99f76e3227
1 changed files with 3 additions and 6 deletions

View File

@ -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")