1
0
Fork 0

Update YSFGateway.cpp

fixed the "segmentation fault" error in case a non-existent room is requested
master
Antonio Matraia 1 year ago
parent 3409e45d83
commit daef16c145

@ -273,7 +273,8 @@ int CYSFGateway::run()
for (;;) { for (;;) {
unsigned char buffer[200U]; unsigned char buffer[200U];
memset(buffer, 0U, 200U); memset(buffer, 0U, 200U);
bool wx_tmp;
while (rptNetwork.read(buffer) > 0U) { while (rptNetwork.read(buffer) > 0U) {
CYSFFICH fich; CYSFFICH fich;
bool valid = fich.decode(buffer + 35U); bool valid = fich.decode(buffer + 35U);
@ -282,14 +283,22 @@ int CYSFGateway::run()
unsigned char dt = fich.getDT(); unsigned char dt = fich.getDT();
CYSFReflector* reflector = m_wiresX->getReflector(); CYSFReflector* reflector = m_wiresX->getReflector();
if (m_ysfNetwork != NULL && m_linkType == LINK_YSF && wiresXCommandPassthrough && reflector->m_wiresX) { if (reflector != NULL)
wx_tmp = reflector->m_wiresX;
else
wx_tmp = 0;
if (m_ysfNetwork != NULL && m_linkType == LINK_YSF && wiresXCommandPassthrough && wx_tmp) {
processDTMF(buffer, dt); processDTMF(buffer, dt);
processWiresX(buffer, fich, true, wiresXCommandPassthrough); processWiresX(buffer, fich, true, wiresXCommandPassthrough);
} else { } else {
processDTMF(buffer, dt); processDTMF(buffer, dt);
processWiresX(buffer, fich, false, wiresXCommandPassthrough); processWiresX(buffer, fich, false, wiresXCommandPassthrough);
reflector = m_wiresX->getReflector(); //reflector may have changed reflector = m_wiresX->getReflector(); //reflector may have changed
if (m_ysfNetwork != NULL && m_linkType == LINK_YSF && reflector->m_wiresX) if (reflector != NULL)
wx_tmp = reflector->m_wiresX;
else
wx_tmp = 0;
if (m_ysfNetwork != NULL && m_linkType == LINK_YSF && wx_tmp)
m_exclude = (dt == YSF_DT_DATA_FR_MODE); m_exclude = (dt == YSF_DT_DATA_FR_MODE);
} }

Loading…
Cancel
Save