We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 12fb1d2 + 8cb62fe commit 521e071Copy full SHA for 521e071
1 file changed
services/inputflinger/reader/EventHub.cpp
@@ -662,8 +662,12 @@ bool EventHub::Device::hasKeycodeLocked(int keycode) const {
662
if (hasKeycodeInternalLocked(keycode)) {
663
return true;
664
}
665
-
666
- for (auto& fromKey : getKeyCharacterMap()->findKeyCodesMappedToKeyCode(keycode)) {
+ // Check the key character map first. Not all input devices will have one.
+ const std::shared_ptr<KeyCharacterMap> kcm = getKeyCharacterMap();
667
+ if (kcm == nullptr) {
668
+ return false;
669
+ }
670
+ for (auto& fromKey : kcm->findKeyCodesMappedToKeyCode(keycode)) {
671
if (hasKeycodeInternalLocked(fromKey)) {
672
673
0 commit comments