Skip to content

Commit

Permalink
udp_server: fix crash when dialog opens for the first time (#1002)
Browse files Browse the repository at this point in the history
UDP server dialogue crashes when theres no protocol stored in settings,
as the default is wrongly "JSON", but it should be "json".

This patch uses default "json" even when there is wrong protocol in
settings to prevent further crashes.
  • Loading branch information
trnila authored Nov 10, 2024
1 parent f4f9d41 commit 107252d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plotjuggler_plugins/DataStreamUDP/udp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ bool UDP_Server::start(QStringList*)

// load previous values
QSettings settings;
QString protocol = settings.value("UDP_Server::protocol", "JSON").toString();
QString address_str = settings.value("UDP_Server::address", "127.0.0.1").toString();
int port = settings.value("UDP_Server::port", 9870).toInt();
QString protocol = settings.value("UDP_Server::protocol").toString();
if (parserFactories()->find(protocol) == parserFactories()->end())
{
protocol = "json";
}

dialog.ui->lineEditAddress->setText(address_str);
dialog.ui->lineEditPort->setText(QString::number(port));
Expand Down

0 comments on commit 107252d

Please sign in to comment.