From c9e2293a6cb1f008a1384aaac9f047a2d6e6e5e5 Mon Sep 17 00:00:00 2001 From: Xeriab Nabil Date: Mon, 6 Sep 2021 15:59:48 +0300 Subject: [PATCH] Server: Fix character deletion mentioned in #1327 --- server/src/persistence/character.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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) }