diff --git a/jong-line/src/tables.rs b/jong-line/src/tables.rs index 87698a5..fdf75d5 100644 --- a/jong-line/src/tables.rs +++ b/jong-line/src/tables.rs @@ -139,8 +139,9 @@ pub struct HandView { #[view(accessor = view_closed_hands, public)] fn view_closed_hands(ctx: &ViewContext) -> Vec { - let this_player = ctx.db.player().identity().find(ctx.sender()).unwrap(); - if let Some(lobby) = ctx.db.lobby().id().find(this_player.lobby_id) { + if let Some(this_player) = ctx.db.player().identity().find(ctx.sender()) + && let Some(lobby) = ctx.db.lobby().id().find(this_player.lobby_id) + { lobby .players .iter() diff --git a/jong/src/riichi.rs b/jong/src/riichi.rs index fa0d772..7b2b902 100644 --- a/jong/src/riichi.rs +++ b/jong/src/riichi.rs @@ -226,12 +226,13 @@ fn on_player_insert_update( mut commands: Commands, main_player: Option>, - other_players: Query<&Player>, + other_players: Query<&Player, Without>, mut next_turnstate: ResMut>, ) { for msg in messages.read() { debug!("on_player_insert_update: {:?}", msg.new); + assert_eq!(msg.new.identity, stdb.identity()); if main_player.is_none() && msg.new.identity == stdb.identity() { // trace!("spawn_main_player"); spawn_main_player(&stdb, &mut commands, &mut next_turnstate, &msg.new); diff --git a/jong/src/tui/render.rs b/jong/src/tui/render.rs index 817e713..9163e09 100644 --- a/jong/src/tui/render.rs +++ b/jong/src/tui/render.rs @@ -165,7 +165,7 @@ pub(crate) fn render_main_hand( let hand: Vec<_> = hand .iter() .find_map(|(c, e)| { - debug!("main_player children: {:?}", *main_player); + // debug!("main_player children: {:?}", *main_player); if main_player.contains(&e) { Some(c) } else {