[apps/hardware_test] Fix bug: overwriting wrong memory space

Change-Id: Ie29e657d91ddef78ecf7c0d75f1eac937bb8213f
This commit is contained in:
Émilie Feral
2017-04-21 16:13:01 +02:00
parent 93e98abf17
commit 415ab22fa2
2 changed files with 7 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
#include "empty_battery_window.h"
#include "i18n.h"
#include "global_preferences.h"
#include "i18n.h"
extern "C" {
#include <assert.h>
}

View File

@@ -21,13 +21,17 @@ Ion::Keyboard::Key KeyboardView::testedKey() const {
}
void KeyboardView::setDefectiveKey(Ion::Keyboard::Key key) {
m_defectiveKey[(int)key] = 1;
int keyIndex = (int)key;
if (keyIndex < Ion::Keyboard::NumberOfKeys && keyIndex >= 0) {
m_defectiveKey[(int)key] = 1;
}
}
bool KeyboardView::setNextKey() {
m_testedKey = (Ion::Keyboard::Key)((int)m_testedKey+1);
int keyIndex = (int)m_testedKey;
if (keyIndex >= 54) {
if (keyIndex == 55) {
resetTestedKey();
return false;
}
if ((keyIndex > 7 && keyIndex < 12) || keyIndex == 35 || keyIndex == 41 || keyIndex == 47 || keyIndex == 53) {