Skip to content

Commit

Permalink
Fixed samsung hardware menu button crash
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill committed Apr 4, 2019
1 parent cd20315 commit 53e2202
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ public boolean onCreateOptionsMenu(final Menu menu) {
}

MenuItem menuItemCrop = menu.findItem(R.id.menu_crop);
Drawable menuItemCropIcon = ContextCompat.getDrawable(this, mToolbarCropDrawable);
Drawable menuItemCropIcon = ContextCompat.getDrawable(this, mToolbarCropDrawable == 0 ? R.drawable.ucrop_ic_done : mToolbarCropDrawable);
if (menuItemCropIcon != null) {
menuItemCropIcon.mutate();
menuItemCropIcon.setColorFilter(mToolbarWidgetColor, PorterDuff.Mode.SRC_ATOP);
Expand All @@ -544,7 +544,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_crop) {
if (fragment.isAdded())
if (fragment != null && fragment.isAdded())
fragment.cropAndSaveImage();
} else if (item.getItemId() == android.R.id.home) {
removeFragmentFromScreen();
Expand Down

0 comments on commit 53e2202

Please sign in to comment.