Skip to content

Commit

Permalink
Android: Make sure the NetworkChangeNotifier is initialized in getAut…
Browse files Browse the repository at this point in the history
…hToken

BUG=224019

Review URL: https://chromiumcodereview.appspot.com/14424008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196396 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
clamy@chromium.org committed Apr 25, 2013
1 parent f3c083d commit 950e33e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public static NetworkChangeNotifier init(Context context) {
return sInstance;
}

public static boolean isInitialized() {
return sInstance != null;
}

static void resetInstanceForTests(Context context) {
sInstance = new NetworkChangeNotifier(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ public String doInBackground(Void... params) {
@Override
public void onPostExecute(String authToken) {
if (authToken != null || !errorEncountered.get() ||
numTries.incrementAndGet() == MAX_TRIES) {
numTries.incrementAndGet() == MAX_TRIES ||
!NetworkChangeNotifier.isInitialized()) {
callback.tokenAvailable(authToken);
return;
}
Expand Down

0 comments on commit 950e33e

Please sign in to comment.