Add additional error checking on tx action

pull/655/head
Jon Beniston 2020-10-09 20:05:44 +01:00
rodzic 0e4c3ec317
commit 3e1a89695b
1 zmienionych plików z 24 dodań i 8 usunięć

Wyświetl plik

@ -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
{ {