-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Long story short, the build fails with "unreachable code" in Source/USK/Widgets/MenuItem.cpp, here on line 402:
/**
* @brief Called when trying to go back in the menu
* @return A boolean value indicating if the back event was handled
*/
bool UMenuItem::OnMenuBack()
{
#if ENGINE_MAJOR_VERSION >= 5
if (!WaitingForKeyPress)
{
return false;
}
WaitingForKeyPress = false;
SetText(FText::GetEmpty());
UpdateInputIndicator();
return true;
#endif
return false; //<-- unreachable code, when the preprocessor glues in the block behind the #if/#endif, it becomes a return true; followed by a return false;
}
The fix for this is rather simple, instead of just using the #if/#endif, use the whole #if/#else/#endif construct.
/**
* @brief Called when trying to go back in the menu
* @return A boolean value indicating if the back event was handled
*/
bool UMenuItem::OnMenuBack()
{
#if ENGINE_MAJOR_VERSION >= 5
if (!WaitingForKeyPress)
{
return false;
}
WaitingForKeyPress = false;
SetText(FText::GetEmpty());
UpdateInputIndicator();
return true;
#else
/**
* Shark changed this, put the #else part in, and moved the "return false;" between the #else and #endif to avoid the following build error
* U:\Unreal Projects\5.4.4\BlankCppProject\Plugins\UltimateStarterKit-UE5.3-shark\Source\USK\Widgets\MenuItem.cpp(402): error C4702: unreachable code
*/
return false;
#endif
}
I'm too lazy to fork and push out a PR for this.
Metadata
Metadata
Assignees
Labels
No labels