Fixed a bug causing failure when user strings are empty.
This commit is contained in:
parent
e48aca279d
commit
f185106e08
1 changed files with 9 additions and 7 deletions
|
@ -39,6 +39,7 @@ pub enum AccessLevel {
|
||||||
|
|
||||||
impl AccessLevel {
|
impl AccessLevel {
|
||||||
pub fn from_str(s: &str) -> AccessLevel {
|
pub fn from_str(s: &str) -> AccessLevel {
|
||||||
|
if s.len() == 0 { Member } else {
|
||||||
match s.char_at(0) {
|
match s.char_at(0) {
|
||||||
'~' => Owner,
|
'~' => Owner,
|
||||||
'&' => Admin,
|
'&' => Admin,
|
||||||
|
@ -48,6 +49,7 @@ impl AccessLevel {
|
||||||
_ => Member,
|
_ => Member,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show, PartialEq)]
|
#[deriving(Show, PartialEq)]
|
||||||
|
|
Loading…
Reference in a new issue