Merge pull request #4577 from nextcloud/ezaquarii/fix-npe-in-preview-media-fragment

Fix NPE in PreviewMediaFragment
This commit is contained in:
Tobias Kaminsky 2019-10-02 09:02:35 +02:00 committed by GitHub
commit b204db0f1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,6 +79,7 @@ import javax.inject.Inject;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
/**
* This fragment shows a preview of a downloaded media file (audio or video).
@ -510,9 +511,9 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
@Override
protected void onPostExecute(Uri uri) {
PreviewMediaFragment previewMediaFragment = previewMediaFragmentWeakReference.get();
if (previewMediaFragment != null) {
final PreviewMediaFragment previewMediaFragment = previewMediaFragmentWeakReference.get();
final Context context = previewMediaFragment != null ? previewMediaFragment.getContext() : null;
if (previewMediaFragment != null && context != null) {
if (uri != null) {
previewMediaFragment.mVideoUri = uri;
previewMediaFragment.mVideoPreview.setVideoURI(uri);