OculusBoundaryComponent crashes when no HMD connected

If using OculusBoundaryComponent, but no HMD is connected and Vive is also setup but not turned on (so it runs an inactive SteamVR). Oculus BoundaryComponent crashes in OnTick:

The fix is to check that the XRSystem is valid:

if (GEngine->XRSystem.IsValid())

So the code now looks like this:

void UOculusBoundaryComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
#if OCULUS_HMD_SUPPORTED_PLATFORMS
	FOculusHMD* OculusHMD = nullptr;
	if (GEngine)
	{
		if (GEngine->XRSystem.IsValid())
		{
			OculusHMD = (FOculusHMD*)(GEngine->XRSystem->GetHMDDevice());
		}
	}

	if (OculusHMD && OculusHMD->IsHMDActive())

In OculusBoundaryComponent.cpp

Hello,

Could you please provide the contents of the call stack when you receive this crash. Also for clarification, is this happening in a new project or is this from a project that you have upgraded from 4.17.

Thank you.

It’s an upgraded project, haven’t tested it with a fresh one. I’ll test and send the call stack.

I’ve pull requested the fix. https://github.com/EpicGames/UnrealEngine/pull/4165

Callstack having reverted my fix:

link text

This occurs when running up into the editor after the VR system initialises.
To make it go wrong, run with SteamVR system installed but with the HMD/Sensors turned off. I also have an Oculus installed but not connected.

Hey Jimsnomis,

So I was able to reproduce a similar bug with this where my 4.18 projects would crash the moment I added the boundary component with no HMD connected. 4.17 I was having no issues what so ever. I have created a bug report for the crash I was receiving and linked yours in as well as a related issue.

You can follow the bug report here UE-52092

In time this should resolve both of the issues, one with your OnTick crash and the adding boundary component crash.

Thank you.

Great thanks!