VRCompositor was nullptr when using SteamVRSplash

We’re upgrading from 4.18 to 4.21 and have discovered that using splash screens suddenly crashes the game. This is quite surprising, since the docs explicitly recommend using them during, for example, loading levels.

What’s even more surprising is that the UE Issue Tracker note for this is marked as a non-issue.

UE-62486 Crash is a non-issue for recommended practice?

In any case, this issue appears to be caused by the SteamVRHMD->VRCompositor being nullptr despite SteamVRHMD->pBridge->Present(Dummy) returning true, which, according to the comment directly above the check:

// Note, that we use the fact that BridgeBaseImpl::Present only returns false when VRCompositor is null,
// even though when used by the renderer as an indication whether normal present is needed.

My conclusion is that somehow the pBridge’s copy of the VRCompositor is still valid while the SteamVRHMD’s copy is being unset for some reason.

What can be done to get this fixed? It’s apparently been an issue for three Major engine versions.

The proposed workaround of “Don’t use splash screens” (which goes against recommended practices) would simply leave our users in the dark for however long we needed to load the level, which is undesirable and the whole reason we started using splash screens to begin with.

I resolved this (not fully tested) by changing lines 52 and 53 to become:

		SteamVRHMD->pBridge->PostPresent();

This runs the VRCompositor->PostPresentHandoff(); itself anyways and doesn’t seem to cause the crash.