Skip to content

Commit 39686cf

Browse files
committed
Fix crash when opening in hub lobby
1 parent cf90a2d commit 39686cf

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Source/UltiCross/Private/SUltiCrossConfigDialog.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,10 @@ void SUltiCrossConfigDialog::OnDialogResult(TSharedPtr<SCompoundWidget> Widget,
393393

394394
if (PlayerController.IsValid())
395395
{
396-
HUD = PlayerController->MyUTHUD;
396+
AUTPlayerController* UTPlayerController = Cast<AUTPlayerController>(PlayerController.Get());
397+
if (UTPlayerController != nullptr) {
398+
HUD = UTPlayerController->MyUTHUD;
399+
}
397400
}
398401

399402
for (UUltiCrosshair* Crosshair : Crosshairs)

Source/UltiCross/Private/SUltiCrossConfigDialog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SUltiCrossConfigDialog : public SUTDialogBase, public FGCObject
1919
, _ContentPadding(FVector2D(10.0f, 5.0f))
2020
{}
2121
SLATE_ARGUMENT(TWeakObjectPtr<class UUTLocalPlayer>, PlayerOwner)
22-
SLATE_ARGUMENT(TWeakObjectPtr<class AUTPlayerController>, PlayerController)
22+
SLATE_ARGUMENT(TWeakObjectPtr<class AUTBasePlayerController>, PlayerController)
2323
SLATE_ARGUMENT(FText, DialogTitle)
2424
SLATE_ARGUMENT(FVector2D, DialogSize)
2525
SLATE_ARGUMENT(bool, bDialogSizeIsRelative)
@@ -60,7 +60,7 @@ class SUltiCrossConfigDialog : public SUTDialogBase, public FGCObject
6060
private:
6161
friend class FUltiCrosshairViewModel;
6262

63-
TWeakObjectPtr<AUTPlayerController> PlayerController;
63+
TWeakObjectPtr<AUTBasePlayerController> PlayerController;
6464

6565
TSharedRef<FUltiCrosshairViewModel> CrosshairViewModel;
6666

Source/UltiCross/Private/UltiCross.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ bool FUltiCrossExecHandler::Exec(class UWorld* InWorld, const TCHAR* Cmd, FOutpu
7474
{
7575
Ar.Log(TEXT("UltiCross Activated"));
7676

77-
AUTPlayerController* PlayerController = Cast<AUTPlayerController>(GEngine->GetFirstLocalPlayerController(InWorld));
77+
AUTBasePlayerController* PlayerController = Cast<AUTBasePlayerController>(GEngine->GetFirstLocalPlayerController(InWorld));
7878
UUTLocalPlayer* Player = Cast<UUTLocalPlayer>(PlayerController->Player);
7979

8080
TSharedRef<class SUTDialogBase> Dialog = SNew(SUltiCrossConfigDialog)

0 commit comments

Comments
 (0)