From 5617b1fe22311d845b7c027232f154819a566cf6 Mon Sep 17 00:00:00 2001 From: David Gilbert <gilbert@vr.rwth-aachen.de> Date: Mon, 22 Jul 2024 09:53:42 +0200 Subject: [PATCH] fix(pawn): Adds check for invalid IMC --- Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index 7505935d..d5057853 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -6,6 +6,7 @@ #include "Engine/LocalPlayer.h" #include "GameFramework/PlayerController.h" #include "ILiveLinkClient.h" +#include "InputMappingContext.h" #include "Core/RWTHVRPlayerState.h" #include "Kismet/GameplayStatics.h" #include "Logging/StructuredLog.h" @@ -143,9 +144,16 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen } // bind the current mapping contexts - for (const auto& Mapping : InputMappingContexts) + for (const auto Mapping : InputMappingContexts) { - AddInputMappingContext(PlayerController, Mapping); + if (Mapping && IsValid(Mapping)) + { + AddInputMappingContext(PlayerController, Mapping); + } + else + { + UE_LOGFMT(Toolkit, Warning, "ARWTHVRPawn::SetupPlayerInputComponent: InputMappingContext was invalid!"); + } } } -- GitLab