diff --git a/lib/pages/button_simulator.dart b/lib/pages/button_simulator.dart index 4fdab2e..b3ef274 100644 --- a/lib/pages/button_simulator.dart +++ b/lib/pages/button_simulator.dart @@ -108,7 +108,9 @@ class _ButtonSimulatorState extends State { Future.delayed( _keyPressDuration, () { - _sendKey(context, down: false, action: action, connection: connection); + if (mounted) { + _sendKey(context, down: false, action: action, connection: connection); + } }, ); return KeyEventResult.handled; @@ -371,8 +373,8 @@ class _HotkeySettingsDialogState extends State<_HotkeySettingsDialog> { final key = event.logicalKey.keyLabel.toLowerCase(); - // Only allow 1-9 and a-z - if (_validHotkeyPattern.hasMatch(key)) { + // Only allow single character 1-9 and a-z + if (key.length == 1 && _validHotkeyPattern.hasMatch(key)) { setState(() { _editableHotkeys[_editingAction!] = key; _editingAction = null;