Added new validation check for homeSpan.resetIID()

New value must be equal to, or greater than, the last IID value used.  This prevents possible re-use.
This commit is contained in:
Gregg 2024-04-15 22:14:05 -05:00
parent 73561328e6
commit fe3269e9ef
1 changed files with 5 additions and 3 deletions

View File

@ -1594,13 +1594,15 @@ Span& Span::resetIID(int newIID){
while(1);
}
if(newIID<1){
LOG0("\nFATAL ERROR! Can't reset the Accessory IID count to a value less than 1 ***\n");
newIID--;
if(newIID<Accessories.back()->iidCount){
LOG0("\nFATAL ERROR! Can't reset the Accessory IID count to a value less than already used ***\n");
LOG0("\n=== PROGRAM HALTED ===");
while(1);
}
Accessories.back()->iidCount=newIID-1;
Accessories.back()->iidCount=newIID;
return(*this);
}