You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-14 19:02:33 +03:00
turn NPE into a throw
This commit is contained in:
@@ -239,9 +239,13 @@ export function makeUserPermalink(userId) {
|
|||||||
export function makeRoomPermalink(roomId) {
|
export function makeRoomPermalink(roomId) {
|
||||||
const permalinkBase = `${baseUrl}/#/${roomId}`;
|
const permalinkBase = `${baseUrl}/#/${roomId}`;
|
||||||
|
|
||||||
|
if (!roomId) {
|
||||||
|
throw new Error("can't permalink a falsey roomId");
|
||||||
|
}
|
||||||
|
|
||||||
// If the roomId isn't actually a room ID, don't try to list the servers.
|
// If the roomId isn't actually a room ID, don't try to list the servers.
|
||||||
// Aliases are already routable, and don't need extra information.
|
// Aliases are already routable, and don't need extra information.
|
||||||
if (!roomId || roomId[0] !== '!') return permalinkBase;
|
if (roomId[0] !== '!') return permalinkBase;
|
||||||
|
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
const room = client.getRoom(roomId);
|
const room = client.getRoom(roomId);
|
||||||
|
|||||||
Reference in New Issue
Block a user