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,16 +575,32 @@ int PacketMod::webapiActionsPost(
if (channelActionsKeys.contains("tx")) if (channelActionsKeys.contains("tx"))
{ {
SWGSDRangel::SWGPacketModActions_tx* tx = swgPacketModActions->getTx(); SWGSDRangel::SWGPacketModActions_tx* tx = swgPacketModActions->getTx();
QString callsign(*tx->getCallsign()); QString *callsignP = tx->getCallsign();
QString to(*tx->getTo()); QString *toP = tx->getTo();
QString via(*tx->getVia()); QString *viaP = tx->getVia();
QString data(*tx->getData()); 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); PacketMod::MsgTXPacketMod *msg = PacketMod::MsgTXPacketMod::create(callsign, to, via, data);
m_basebandSource->getInputMessageQueue()->push(msg); 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;
} }
return 202;
} }
else else
{ {