AmericanWhitewater / aw-ios

American Whitewater's iOS app
5 stars 2 forks source link

Fix crash from error handler getting called multiple times. #205

Closed Gregliest closed 3 years ago

Gregliest commented 3 years ago

Fix two crashes.

  1. Crashes on DispatchGroup here, here, and here. The error callback was getting called multiple times, since the fetchRecursively function creates multiple requests, each of which can throw an error. Since DispatchGroup.leave() was called in the error callback, it could get called more than once, or get called in addition to the success handler, causing the crash.
  2. Table view has no elements.. I wasn't able to repro this crash.
Gregliest commented 3 years ago

@yeahphil I believe the success handler here is always called when all the recursive calls have returned, even if all the requests fail.