Fix a crash on unknown role
This commit is contained in:
parent
a84769890b
commit
28460d2f6f
1 changed files with 3 additions and 0 deletions
|
@ -26,6 +26,7 @@ import curses
|
||||||
import theme
|
import theme
|
||||||
|
|
||||||
ROLE_DICT = {
|
ROLE_DICT = {
|
||||||
|
'':0,
|
||||||
'none':0,
|
'none':0,
|
||||||
'visitor':1,
|
'visitor':1,
|
||||||
'participant':2,
|
'participant':2,
|
||||||
|
@ -47,6 +48,8 @@ class User(object):
|
||||||
self.affiliation = affiliation
|
self.affiliation = affiliation
|
||||||
self.show = show
|
self.show = show
|
||||||
self.status = status
|
self.status = status
|
||||||
|
if role not in ROLE_DICT: # avoid unvalid roles
|
||||||
|
role = ''
|
||||||
self.role = role
|
self.role = role
|
||||||
|
|
||||||
def change_nick(self, nick):
|
def change_nick(self, nick):
|
||||||
|
|
Loading…
Reference in a new issue