FileDetailFragment: prevent NullPointerException if fileDetailSharingFragment is called too soon

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey Vilas 2021-12-03 16:50:37 +01:00
parent 53999c809c
commit b7d51e573a

View file

@ -169,6 +169,9 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
* @return reference to the {@link FileDetailSharingFragment}
*/
public FileDetailSharingFragment getFileDetailSharingFragment() {
if (binding == null) {
return null;
}
return ((FileDetailTabAdapter) binding.pager.getAdapter()).getFileDetailSharingFragment();
}