diff --git a/server/src/persistence/character.rs b/server/src/persistence/character.rs index 1b19ccf18b..b5981d911d 100644 --- a/server/src/persistence/character.rs +++ b/server/src/persistence/character.rs @@ -544,6 +544,14 @@ pub fn delete_character( stmt.execute(&[&char_id])?; drop(stmt); + let pet_ids = get_pet_ids(char_id, transaction)? + .iter() + .map(|x| Value::from(*x)) + .collect::>(); + if !pet_ids.is_empty() { + delete_pets(transaction, char_id, Rc::new(pet_ids))?; + } + // Delete character let mut stmt = transaction.prepare_cached( " @@ -598,14 +606,6 @@ pub fn delete_character( ))); } - let pet_ids = get_pet_ids(char_id, transaction)? - .iter() - .map(|x| Value::from(*x)) - .collect::>(); - if !pet_ids.is_empty() { - delete_pets(transaction, char_id, Rc::new(pet_ids))?; - } - load_character_list(requesting_player_uuid, transaction) }