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 {
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 =
......
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