AvailabilityTable getEntryByDate does not work properly
Multi platform library to read and write schedule data
Brought to you by:
joniles
Simple example.
If you have two Availabilities in the List, and pass a date that is bigger than the first item but would be in the second item.
int comparisonResult = range.compareTo(date);
in the first item you get here 1.
because you are more or equal 0 you get into the if. you are not 0 though so result is still null. but you get into the break that intrerupts the for loop and the method returns the result which is null.
The break needs to be in the if comparisonResul==0 check so:
if (comparisonResult == 0)
{
result = entry;
break;
}
Else any value that is bigger than the first item checked will return null.
The code now in git fixes this issue.