Fixed a bug causing failure when user strings are empty.

This commit is contained in:
Aaron Weiss 2014-10-27 12:53:20 -04:00
parent e48aca279d
commit f185106e08

View file

@ -39,13 +39,15 @@ pub enum AccessLevel {
impl AccessLevel {
pub fn from_str(s: &str) -> AccessLevel {
match s.char_at(0) {
'~' => Owner,
'&' => Admin,
'@' => Oper,
'%' => HalfOp,
'+' => Voice,
_ => Member,
if s.len() == 0 { Member } else {
match s.char_at(0) {
'~' => Owner,
'&' => Admin,
'@' => Oper,
'%' => HalfOp,
'+' => Voice,
_ => Member,
}
}
}
}