Move guard statements outside of loop

This commit is contained in:
Daniel Lorch 2025-05-08 20:25:53 +02:00
parent aeaed88af5
commit 4d840b65a9
1 changed files with 2 additions and 3 deletions
ui/src/components/popovers

View File

@ -56,14 +56,13 @@ export default function PasteModal() {
setPasteMode(false);
setDisableVideoFocusTrap(false);
if (rpcDataChannel?.readyState !== "open" || !TextAreaRef.current) return;
if (!keyboardLayout) return;
if (!chars[keyboardLayout]) return;
const text = TextAreaRef.current.value;
try {
for (const char of text) {
if (!keyboardLayout) continue;
if (!chars[keyboardLayout]) continue;
const { key, shift, altRight, deadKey, accentKey } = chars[keyboardLayout][char]
if (!key) continue;