Skip to content

Commit

Permalink
fix: add optional chaining operator for preventing unexpected crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
MrQuackDuck committed Dec 19, 2024
1 parent 3578f79 commit 7170ff4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/entities/Room/lib/providers/SelectedRoomProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const SelectedRoomProvider = ({ children }) => {

useEffect(() => {
if (!joinedRooms) return;
const currentRoom = joinedRooms?.find((room) => room.guid === selectedRoom?.guid);
const currentRoom = joinedRooms?.find((room) => room?.guid === selectedRoom?.guid);
if (currentRoom) setSelectedRoom(currentRoom);
}, [joinedRooms]);

Expand Down

0 comments on commit 7170ff4

Please sign in to comment.