Skip to content

Commit d333934

Browse files
authored
Fix null pointer exception on motd fetch failure (#1071)
1 parent fa94955 commit d333934

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/lobby.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,10 @@ void Lobby::get_motd()
553553
{
554554
document = tr("Couldn't get the message of the day.");
555555
}
556-
ui_motd_text->setHtml(document);
556+
if (ui_motd_text)
557+
{
558+
ui_motd_text->setHtml(document);
559+
}
557560
});
558561
}
559562

src/lobby.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Lobby : public QMainWindow
8282
QPushButton *ui_refresh_button;
8383

8484
// Serverinfo / MOTD Horizontal Row
85-
QTextBrowser *ui_motd_text;
85+
QPointer<QTextBrowser> ui_motd_text;
8686

8787
QLabel *ui_server_player_count_lbl;
8888
QTextBrowser *ui_server_description_text;

0 commit comments

Comments
 (0)