Skip to content

Commit

Permalink
Check if owner & car_user is user that left
Browse files Browse the repository at this point in the history
  • Loading branch information
Chi-EEE committed Dec 14, 2023
1 parent 815e293 commit afd63aa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/backend/src/room/Room.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ class Room
return user_ptr->getId() == user.getId();
}
), this->users.end());
// TODO: Check if owner / car_user has left the room
if (this->owner->getId() == user.getId()) {
if (!this->isEmpty())
this->owner = this->users[0];
else
this->owner = nullptr;
}
if (this->car_user->getId() == user.getId()) {
this->car_user = nullptr;
}
}

int getSize() const {
Expand Down

0 comments on commit afd63aa

Please sign in to comment.