Conform more of the codebase with strictNullChecks (#10703)

This commit is contained in:
Michael Telatynski 2023-04-25 09:28:48 +01:00 committed by GitHub
parent db40479910
commit 619a9e8542
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 108 additions and 77 deletions

View file

@ -74,10 +74,12 @@ export default class VerificationRequestToast extends React.PureComponent<IProps
if (request.isSelfVerification) {
const cli = MatrixClientPeg.get();
const device = await cli.getDevice(request.channel.deviceId);
const ip = device.last_seen_ip;
const device = request.channel.deviceId ? await cli.getDevice(request.channel.deviceId) : null;
const ip = device?.last_seen_ip;
this.setState({
device: cli.getStoredDevice(cli.getUserId()!, request.channel.deviceId) ?? undefined,
device:
(request.channel.deviceId && cli.getStoredDevice(cli.getSafeUserId(), request.channel.deviceId)) ||
undefined,
ip,
});
}