diff --git a/src/app/features/room/RoomInput.tsx b/src/app/features/room/RoomInput.tsx index 3b03e96bd..af028c8db 100644 --- a/src/app/features/room/RoomInput.tsx +++ b/src/app/features/room/RoomInput.tsx @@ -109,6 +109,7 @@ import { loadImageElementFromMediaUrl } from '$utils/dom'; import { safeFile } from '$utils/mimeTypes'; import { fulfilledPromiseSettledResult } from '$utils/common'; import { useSetting } from '$state/hooks/settings'; +import type { EditorButtonId } from '$state/settings'; import { settingsAtom } from '$state/settings'; import { matchesShortcut } from '../../keyboard/shortcuts'; import { @@ -2352,9 +2353,10 @@ export const RoomInput = forwardRef( }; for (let i = editorButtonOrder.length - 1; i >= 0; i--) { const id = editorButtonOrder[i]; - const ref = buttonRefs[id]; - if (ref?.current) { - return ref.current.getBoundingClientRect(); + if (!id) continue; + const btnRef = buttonRefs[id]; + if (btnRef?.current) { + return btnRef.current.getBoundingClientRect(); } } return undefined;