blonsky95 / DigiCoachAndroid

0 stars 0 forks source link

bug - deleteing exercise in use causes crash #94

Closed blonsky95 closed 4 years ago

blonsky95 commented 4 years ago

Problem - getting a concurrent modification exception when updating days containing an exercise.

It iterates through the days exercises to check if they contain the exercise, and deletes them if delete or updates them if update. In case of deletion, it would continue to iterate so the next() iterator method would throw error as the array through which it iterates has changed.

Solution: The function updating days containing exercise is called once per exercise, and can only be one time in a day so, when it finds the exercise either in update or delete, it will break (break keyword when condition is met) the loop and move on to the next day.