Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4151)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java

Issue 2572483004: Fix null pointer crash when VR code is not enabled (Closed)
Patch Set: nit Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
index 461fd5043874f5a28e403944fda1a120c0696a02..603205ccef85410802ba8df6d7e8af4ecb4448fa 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
@@ -68,7 +68,7 @@ public class VrShellDelegate {
private final Intent mEnterVRIntent;
private boolean mVrAvailable;
- private boolean mCardboardSupportOnly;
+ private boolean mCardboardSupportOnly = true;
private Boolean mVrShellEnabled;
private VrClassesBuilder mVrClassesBuilder;
@@ -93,10 +93,10 @@ public class VrShellDelegate {
// TODO(bshe): refactor code so that mCardboardSupportOnly does not depend on mVrAvailable
// and mVrAvailable does not depend on createVrDaydreamApi.
mVrAvailable = createVrClassesBuilder() && isVrCoreCompatible() && createVrDaydreamApi();
- // Make sure mVrDaydreamApi is created as createVrDaydreamApi might not get called above.
- if (mVrDaydreamApi == null) createVrDaydreamApi();
// Only Cardboard mode is supported on non-daydream devices.
- mCardboardSupportOnly = !mVrDaydreamApi.isDaydreamReadyDevice();
+ if (mVrDaydreamApi != null && mVrDaydreamApi.isDaydreamReadyDevice()) {
+ mCardboardSupportOnly = false;
+ }
if (mVrAvailable && !mCardboardSupportOnly) {
mEnterVRIntent =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698