From 264d955fac87d9a23abd96610b48be5fce2a0da5 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 20 Apr 2016 17:55:32 +0200 Subject: [PATCH] Sistemato un crash Traceback (most recent call last): File "mifia.py", line 382, in if voter.alive: AttributeError: 'NoneType' object has no attribute 'alive' Partita -1001042610127 eliminata. --- mifia.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mifia.py b/mifia.py index c9748c9a..74468794 100644 --- a/mifia.py +++ b/mifia.py @@ -379,12 +379,13 @@ while True: username = t['text'].split(' ') if len(username) > 1 and g.findusername(username[1]) is not None: voter = g.findid(t['from']['id']) - if voter.alive: - voter.votedfor = username[1] - g.message("Hai votato per " + username[1] + ".") - else: - g.message("_La tua votazione riecheggia nel nulla._\n" - "\u26A0\uFE0F Sei morto, e i morti non votano.") + if voter is not None: + if voter.alive: + voter.votedfor = username[1] + g.message("Hai votato per " + username[1] + ".") + else: + g.message("_La tua votazione riecheggia nel nulla._\n" + "\u26A0\uFE0F Sei morto, e i morti non votano.") else: g.message("\u26A0\uFE0F La persona selezionata non esiste.") else: