Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Add null types and guards
Browse files Browse the repository at this point in the history
  • Loading branch information
robintown committed Mar 28, 2022
1 parent 31de269 commit f3e09a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/views/rooms/RoomTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
this.setState({ jitsiParticipants: participants });
};

private renderVoiceChannel(): React.ReactElement {
private renderVoiceChannel(): React.ReactElement | null {
let faces;
if (this.state.voiceConnectionState === VoiceConnectionState.Connected) {
faces = this.state.jitsiParticipants.map(p =>
Expand Down
6 changes: 6 additions & 0 deletions src/stores/VoiceChannelStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
*/

import { EventEmitter } from "events";
import { logger } from "matrix-js-sdk/src/logger";
import { ClientWidgetApi, IWidgetApiRequest } from "matrix-widget-api";

import { MatrixClientPeg } from "../MatrixClientPeg";
Expand Down Expand Up @@ -192,6 +193,11 @@ export default class VoiceChannelStore extends EventEmitter {
};

private updateDevices = async (fn: (devices: string[]) => string[]) => {
if (!this.roomId) {
logger.error("Tried to update devices while disconnected");
return;
}

const devices = this.cli.getRoom(this.roomId)
.currentState.getStateEvents(VOICE_CHANNEL_MEMBER, this.cli.getUserId())
?.getContent<IVoiceChannelMemberContent>()?.devices ?? [];
Expand Down

0 comments on commit f3e09a1

Please sign in to comment.