aboutsummaryrefslogtreecommitdiff
path: root/main/main.ino
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.ino')
-rw-r--r--main/main.ino5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/main.ino b/main/main.ino
index 67222ee..e084af1 100644
--- a/main/main.ino
+++ b/main/main.ino
@@ -1,5 +1,7 @@
#include "constants.h"
+#define MIN(a, b) ((a) > (b) ? (b) : (a))
+
/** BN (KB) -> PIN & PIN
* 1 (0) -> D8 & D9
* 2 (1) -> D8 & D7
@@ -215,7 +217,8 @@ void kb_onevent(kb_event ev) {
// voeg getal toe aan het einde van de code
code[codei] = num;
- codei++; //TODO: fix array out of bounds crash
+ codei++;
+ codei = MIN(codei, MAX_CODE_LEN - 1);
}
}
}