Skip to content

Commit 30777c1

Browse files
committed
🎨 Prevent adding existing keys
1 parent e5a6120 commit 30777c1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=KeyDB
2-
version=1.1.1
2+
version=1.1.2
33
author=Andreas <andreas@zapsterstudios.com>
44
maintainer=Andreas <andreas@zapsterstudios.com>
55
sentence=Wrapper around EEPROM as a key storing database.

src/KeyDB.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ void KeyDB::addKey(String key) {
7777
// Make key fixed length.
7878
key = this->keyLengthen(key);
7979

80+
// Return if already exists.
81+
if (this->keyExists(key))
82+
return;
83+
8084
// Set index to new value.
8185
int keys = this->count();
8286
this->keys[keys] = key;

0 commit comments

Comments
 (0)