Commit 00d18877 authored by bshe's avatar bshe Committed by Commit bot

Fix null pointer crash when VR code is not enabled

BUG=673644

Review-Url: https://codereview.chromium.org/2572483004
Cr-Commit-Position: refs/heads/master@{#438207}
parent 08110857
...@@ -68,7 +68,7 @@ public class VrShellDelegate { ...@@ -68,7 +68,7 @@ public class VrShellDelegate {
private final Intent mEnterVRIntent; private final Intent mEnterVRIntent;
private boolean mVrAvailable; private boolean mVrAvailable;
private boolean mCardboardSupportOnly; private boolean mCardboardSupportOnly = true;
private Boolean mVrShellEnabled; private Boolean mVrShellEnabled;
private VrClassesBuilder mVrClassesBuilder; private VrClassesBuilder mVrClassesBuilder;
...@@ -93,10 +93,10 @@ public class VrShellDelegate { ...@@ -93,10 +93,10 @@ public class VrShellDelegate {
// TODO(bshe): refactor code so that mCardboardSupportOnly does not depend on mVrAvailable // TODO(bshe): refactor code so that mCardboardSupportOnly does not depend on mVrAvailable
// and mVrAvailable does not depend on createVrDaydreamApi. // and mVrAvailable does not depend on createVrDaydreamApi.
mVrAvailable = createVrClassesBuilder() && isVrCoreCompatible() && 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. // Only Cardboard mode is supported on non-daydream devices.
mCardboardSupportOnly = !mVrDaydreamApi.isDaydreamReadyDevice(); if (mVrDaydreamApi != null && mVrDaydreamApi.isDaydreamReadyDevice()) {
mCardboardSupportOnly = false;
}
if (mVrAvailable && !mCardboardSupportOnly) { if (mVrAvailable && !mCardboardSupportOnly) {
mEnterVRIntent = mEnterVRIntent =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment