Skip to content

Commit ddf2513

Browse files
committed
GameRecorder: Fix potential crash on SetFrameBuffer
It could happen randomly as it's an async task.
1 parent 164b105 commit ddf2513

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Source/BetaHubBugReporter/Private/BH_GameRecorder.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,16 @@ void UBH_GameRecorder::SetFrameData(int32 Width, int32 Height, const TArray<FCol
440440
{
441441
TSharedPtr<FBH_Frame> Frame = MakeShareable(new FBH_Frame(Width, Height));
442442
Frame->Data = Data;
443-
FrameBuffer->SetFrame(Frame);
443+
444+
// While this is called from an async task, FrameBuffer may or may not be valid
445+
if (FrameBuffer)
446+
{
447+
FrameBuffer->SetFrame(Frame);
448+
}
449+
else
450+
{
451+
UE_LOG(LogBetaHub, Warning, TEXT("FrameBuffer is null."));
452+
}
444453
}
445454

446455
FString UBH_GameRecorder::CaptureScreenshotToJPG(const FString& Filename)

0 commit comments

Comments
 (0)