Skip to content

Commit

Permalink
[flutter_appauth] Fixes null pointer exceptions when attempting to re…
Browse files Browse the repository at this point in the history
…turn a result for a null pending operation (#109)

This situation can occur when too many operations are started at one time. Once one operation completes, there is no longer a pending operation so any operations that complete after will throw a null pointer exception.
  • Loading branch information
josh-burton authored May 1, 2020
1 parent ccf5582 commit 21f85d6
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,17 @@ private void finishWithTokenError(AuthorizationException ex) {


private void finishWithSuccess(Object data) {
pendingOperation.result.success(data);
pendingOperation = null;
if (pendingOperation != null) {
pendingOperation.result.success(data);
pendingOperation = null;
}
}

private void finishWithError(String errorCode, String errorMessage) {
pendingOperation.result.error(errorCode, errorMessage, null);
pendingOperation = null;
if (pendingOperation != null) {
pendingOperation.result.error(errorCode, errorMessage, null);
pendingOperation = null;
}
}

private void finishWithDiscoveryError(AuthorizationException ex) {
Expand Down

0 comments on commit 21f85d6

Please sign in to comment.