Fix callback null crash #4644 (#4649)

This commit is contained in:
Madhur Gupta 2021-09-26 22:03:52 +05:30 committed by GitHub
parent 1c9267ca08
commit ade568008d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -145,19 +145,21 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
presenter.receiveImage(uploadableFile, place); presenter.receiveImage(uploadableFile, place);
initRecyclerView(); initRecyclerView();
if (callback.getIndexInViewFlipper(this) == 0) { if (callback != null) {
btnPrevious.setEnabled(false); if (callback.getIndexInViewFlipper(this) == 0) {
btnPrevious.setAlpha(0.5f); btnPrevious.setEnabled(false);
} else { btnPrevious.setAlpha(0.5f);
btnPrevious.setEnabled(true); } else {
btnPrevious.setAlpha(1.0f); btnPrevious.setEnabled(true);
} btnPrevious.setAlpha(1.0f);
}
//If this is the last media, we have nothing to copy, lets not show the button //If this is the last media, we have nothing to copy, lets not show the button
if (callback.getIndexInViewFlipper(this) == callback.getTotalNumberOfSteps()-4) { if (callback.getIndexInViewFlipper(this) == callback.getTotalNumberOfSteps() - 4) {
btnCopyToSubsequentMedia.setVisibility(View.GONE); btnCopyToSubsequentMedia.setVisibility(View.GONE);
} else { } else {
btnCopyToSubsequentMedia.setVisibility(View.VISIBLE); btnCopyToSubsequentMedia.setVisibility(View.VISIBLE);
}
} }
attachImageViewScaleChangeListener(); attachImageViewScaleChangeListener();