0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00

Don't rely on onCreateOptionsMenu items in onCreate, Fixes #4977

This may not be related to 27.0.2->27.1.1 support lib lifecycle changes,
and it may be present in other objects or have a better solution but this
fixes crash on opening CardBrowser with an empty collection
This commit is contained in:
Mike Hardy 2018-09-17 23:38:50 -05:00 committed by Tim Rae
parent da1f19c75d
commit 7c4878bcff
2 changed files with 5 additions and 4 deletions

View File

@ -567,6 +567,7 @@ public class CardBrowser extends NavigationDrawerActivity implements
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
Timber.d("onCreateOptionsMenu()");
mActionBarMenu = menu;
if (!mInMultiSelectMode) {
// restore drawer click listener and icon
@ -1359,9 +1360,9 @@ public class CardBrowser extends NavigationDrawerActivity implements
@Override
public void onPostExecute(TaskData result) {
if (result != null && mCards != null) {
Timber.i("CardBrowser:: Completed doInBackgroundSearchCards Successfuly");
Timber.i("CardBrowser:: Completed doInBackgroundSearchCards Successfully");
updateList();
if (!mSearchView.isIconified()) {
if ((mSearchView != null) && !mSearchView.isIconified()) {
UIUtils.showSimpleSnackbar(CardBrowser.this, getSubtitleText(), true);
}
}

View File

@ -217,14 +217,14 @@ public class DeckTask extends BaseAsyncTask<DeckTask.TaskData, DeckTask.TaskData
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
// We have been interrupted, return immediately.
Timber.e(e, "interrupted while waiting for previous task: %d", mPreviousTask.mType);
Timber.d(e, "interrupted while waiting for previous task: %d", mPreviousTask.mType);
return null;
} catch (ExecutionException e) {
// Ignore failures in the previous task.
Timber.e(e, "previously running task failed with exception: %d", mPreviousTask.mType);
} catch (CancellationException e) {
// Ignore cancellation of previous task
Timber.e(e, "previously running task was cancelled: %d", mPreviousTask.mType);
Timber.d(e, "previously running task was cancelled: %d", mPreviousTask.mType);
}
}
sLatestInstance = this;