fix empty team bug

This commit is contained in:
ntr 2019-01-11 13:23:05 +11:00
parent 4d79f987d3
commit b91c1620e4
2 changed files with 6 additions and 5 deletions

View File

@ -14,7 +14,6 @@ strangle
## NOW ## NOW
* clean up categories * clean up categories
* scale down damage
* why is the text fucked? * why is the text fucked?
* iconography * iconography
* full svg buttons to not have to fuck around with text * full svg buttons to not have to fuck around with text
@ -23,6 +22,8 @@ strangle
## SOON ## SOON
* aoe skills * aoe skills
* armour and SS
* keep track of games joined * keep track of games joined
* concede game on leave * concede game on leave
* ko all cryps on team, check status * ko all cryps on team, check status

View File

@ -673,15 +673,15 @@ pub fn game_update(game: &Game, tx: &mut Transaction) -> Result<(), Error> {
} }
pub fn game_pve_new(cryp_ids: Vec<Uuid>, mode: PveMode, tx: &mut Transaction, account: &Account) -> Result<Game, Error> { pub fn game_pve_new(cryp_ids: Vec<Uuid>, mode: PveMode, tx: &mut Transaction, account: &Account) -> Result<Game, Error> {
if cryp_ids.len() == 0 {
return Err(err_msg("no cryps selected"));
}
let cryps = cryp_ids let cryps = cryp_ids
.iter() .iter()
.map(|id| cryp_get(tx, *id, account.id)) .map(|id| cryp_get(tx, *id, account.id))
.collect::<Result<Vec<Cryp>, Error>>()?; .collect::<Result<Vec<Cryp>, Error>>()?;
if cryps.len() == 0 {
return Err(err_msg("no cryps selected"));
}
if cryps.len() > 3 { if cryps.len() > 3 {
return Err(err_msg("team size too large (3 max)")); return Err(err_msg("team size too large (3 max)"));
} }