1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 21:01:45 -05:00

Add additional error checking on tx action

This commit is contained in:
Jon Beniston 2020-10-09 20:05:44 +01:00
parent 0e4c3ec317
commit 3e1a89695b

View File

@ -575,18 +575,34 @@ int PacketMod::webapiActionsPost(
if (channelActionsKeys.contains("tx"))
{
SWGSDRangel::SWGPacketModActions_tx* tx = swgPacketModActions->getTx();
QString callsign(*tx->getCallsign());
QString to(*tx->getTo());
QString via(*tx->getVia());
QString data(*tx->getData());
QString *callsignP = tx->getCallsign();
QString *toP = tx->getTo();
QString *viaP = tx->getVia();
QString *dataP = tx->getData();
if (callsignP && toP && viaP && dataP)
{
QString callsign(*callsignP);
QString to(*toP);
QString via(*viaP);
QString data(*dataP);
PacketMod::MsgTXPacketMod *msg = PacketMod::MsgTXPacketMod::create(callsign, to, via, data);
m_basebandSource->getInputMessageQueue()->push(msg);
}
return 202;
}
else
{
errorMessage = "Packet must contain callsign, to, via and data";
return 400;
}
}
else
{
errorMessage = "Unknown action";
return 400;
}
}
else
{
errorMessage = "Missing PacketModActions in query";
return 400;