Index: chrome/browser/android/vr_shell/vr_shell_delegate.cc |
diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.cc b/chrome/browser/android/vr_shell/vr_shell_delegate.cc |
index d324bde0afc51fbbb61f058fbdc0d89d90d1404c..04afe1c512bfee1c83ee5d2d9235c04a5978e9cf 100644 |
--- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc |
+++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc |
@@ -104,10 +104,12 @@ base::WeakPtr<device::GvrDelegate> VrShellDelegate::GetNonPresentingDelegate() { |
} |
void VrShellDelegate::DestroyNonPresentingDelegate() { |
- non_presenting_delegate_.reset(nullptr); |
- JNIEnv* env = AttachCurrentThread(); |
- Java_VrShellDelegate_shutdownNonPresentingNativeContext( |
- env, j_vr_shell_delegate_.obj()); |
+ if (non_presenting_delegate_) { |
+ non_presenting_delegate_.reset(nullptr); |
+ JNIEnv* env = AttachCurrentThread(); |
+ Java_VrShellDelegate_shutdownNonPresentingNativeContext( |
+ env, j_vr_shell_delegate_.obj()); |
+ } |
} |
// ---------------------------------------------------------------------------- |