Skip to content

Commit fceea87

Browse files
authored
Show error in server browser when communities failed to be loaded (ddnet#11675)
2 parents f1cfa05 + 5d5ddce commit fceea87

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/game/client/components/menus_browser.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,17 @@ void CMenus::RenderServerbrowserCommunitiesFilter(CUIRect View)
10131013
View.Draw(ColorRGBA(0.0f, 0.0f, 0.0f, 0.15f), IGraphics::CORNER_B, 4.0f);
10141014

10151015
const int MaxEntries = ServerBrowser()->Communities().size();
1016+
if(MaxEntries == 0)
1017+
{
1018+
CUIRect ErrorLabel;
1019+
View.Margin(5.0f, &ErrorLabel);
1020+
SLabelProperties ErrorLabelProps;
1021+
ErrorLabelProps.m_MaxWidth = ErrorLabel.w;
1022+
ErrorLabelProps.SetColor(ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f));
1023+
Ui()->DoLabel(&ErrorLabel, Localize("Error loading communities"), 10.0f, TEXTALIGN_MC, ErrorLabelProps);
1024+
return;
1025+
}
1026+
10161027
const int EntriesPerRow = 1;
10171028

10181029
static CScrollRegion s_ScrollRegion;
@@ -1863,7 +1874,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
18631874
MainView.VSplitRight(205.0f, &ServerList, &ToolBox);
18641875
ServerList.VSplitRight(5.0f, &ServerList, nullptr);
18651876

1866-
if((g_Config.m_UiPage == PAGE_INTERNET || g_Config.m_UiPage == PAGE_FAVORITES) && !ServerBrowser()->Communities().empty())
1877+
if(g_Config.m_UiPage == PAGE_INTERNET || g_Config.m_UiPage == PAGE_FAVORITES)
18671878
{
18681879
CUIRect CommunityFilter;
18691880
ToolBox.HSplitTop(19.0f + 4.0f * 17.0f + CScrollRegion::HEIGHT_MAGIC_FIX, &CommunityFilter, &ToolBox);

0 commit comments

Comments
 (0)