HaywireInteractive / OnAllFronts-Public

UE5 MilSim FPS / RTS Game (formerly ProjectM)
MIT License
113 stars 22 forks source link

Fix occasional error if can't get supported resolutions #934

Closed Leroy231 closed 2 months ago

Leroy231 commented 4 months ago

When running the project on a remote machine that you connect to via RDP you can get this error:

Blueprint Runtime Error: "Attempted to access index -1 from array CallFunc_GetSupportedFullscreenResolutions_Resolutions_1 of length 0!". Node: Add Graph: GetAvailableResolutionsForWindowMode Function: Get Available Resolutions for Window Mode Blueprint: BP_Setting_Int_DisplayResolution

The issue is that the GetAvailableResolutionsForWindowMode function in BP_Setting_Int_DisplayResolution (screenshot below) calls GetSupportedFullscreenResolutions which may return an empty array. We try to read the last element in the array which may be invalid. To fix we should check if the array is empty and if so skip the "add" node we do in screenshot below.

Image