Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoCommon: Fix crash that occurs on loading a fifo log when Free Look is enabled #9362

Merged
merged 1 commit into from Dec 27, 2020

Conversation

iwubcode
Copy link
Contributor

@iwubcode iwubcode commented Dec 26, 2020

During the Free Look refactor (#8867 ) I apparently forgot to test loading a fifo log. A crash occurs there because the camera control type is not set and therefore the controller is null.

This fixes the crash and adds some safety checks to check for null pointers.

Sorry about that!

EDIT: This crash is not specific to fifo per-se. It's just the fifo logs I tested had an initial frame of projection-type perspective where we call GetView(). Most games I tested startup with a projection type of orthographic, giving time for Renderer::CheckForConfigChanges() to update the control type.

@iwubcode iwubcode changed the title VideoCommon: Fix crash that occurs on loading a fifo log VideoCommon: Fix crash that occurs on loading a fifo log when Free Look is enabled Dec 26, 2020
@leoetlino
Copy link
Member

Alternative approach, which I think would be more robust: call SetControlType(SixAxis) (for instance) in the FreeLookCamera constructor so the object is always in a valid state and we don't have to do those null checks elsewhere.

@iwubcode
Copy link
Contributor Author

@leoetlino - nice idea! Appreciate the suggestion. I updated the code to make that change.

@leoetlino leoetlino merged commit 2917af0 into dolphin-emu:master Dec 27, 2020
10 checks passed
@iwubcode iwubcode deleted the freelook_fix_crash branch December 27, 2020 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants