Adafruit fingerprint sensor library: detecting empty ID

Hi all,

I'm doing a project involving R305 fingerprint sensor. I have successfully used the Adafruit library for this sensor. In my project project the user can enroll fingers and later delete them by entering the ID of that finger that is used by the module.

Imagine the user has enrolled 10 fingers with IDs 0 to 9 then the user deletes say ID 6. After that he wants to enroll another finger, How do I determine the vacant ID? I want to detect that ID 6 is empty to store the new finger in that location.

I reviewed all the examples and googled my issue but, I could find nothing relevant.

Has anyone done something similar? Any clue would be appreciated.

for (size_t i = 1; i < 200; i++)
uint8_t c = finger.loadModel(i);

if (c != FINGERPRINT_OK) {
Serial.println(“Finger Prit Id Not Found”);
fid = i;
uint8_t c = finger.loadModel(-1);