Check we have interface info before printing it

This commit is contained in:
Srivats P 2019-07-28 10:39:29 +05:30
parent 1db768afba
commit ea69335d29

View File

@ -105,17 +105,19 @@ PortManager::PortManager()
}
const InterfaceInfo *intfInfo = port->interfaceInfo();
qDebug("Mac: %012llx", intfInfo->mac);
foreach(Ip4Config ip, intfInfo->ip4)
qDebug("Ip4: %s/%d gw: %s",
qPrintable(QHostAddress(ip.address).toString()),
ip.prefixLength,
qPrintable(QHostAddress(ip.gateway).toString()));
foreach(Ip6Config ip, intfInfo->ip6)
qDebug("Ip6: %s/%d gw: %s",
qPrintable(QHostAddress(ip.address.toArray()).toString()),
ip.prefixLength,
qPrintable(QHostAddress(ip.gateway.toArray()).toString()));
if (intfInfo) {
qDebug("Mac: %012llx", intfInfo->mac);
foreach(Ip4Config ip, intfInfo->ip4)
qDebug("Ip4: %s/%d gw: %s",
qPrintable(QHostAddress(ip.address).toString()),
ip.prefixLength,
qPrintable(QHostAddress(ip.gateway).toString()));
foreach(Ip6Config ip, intfInfo->ip6)
qDebug("Ip6: %s/%d gw: %s",
qPrintable(QHostAddress(ip.address.toArray()).toString()),
ip.prefixLength,
qPrintable(QHostAddress(ip.gateway.toArray()).toString()));
}
if (!port->setRateAccuracy(txRateAccuracy))
qWarning("failed to set rateAccuracy (%d)", txRateAccuracy);