API sanity checks

This commit is contained in:
Akkadius 2017-10-03 15:15:10 -05:00
parent ac87206551
commit 6eea9949b1
1 changed files with 8 additions and 1 deletions

View File

@ -8,8 +8,15 @@ router.get('/', function(req, res, next) {
var count = 0;
for (var key in dhcp_lease_data) {
/* Mac OUI Lookup */
var mac_oui = dhcp_lease_data[key].mac.split(":").join("").toUpperCase().slice(0,6);
var mac_oui = "";
if(typeof dhcp_lease_data[key].mac.split(":").join("") !== "undefined") {
mac_oui = dhcp_lease_data[key].mac.split(":").join("").toUpperCase().slice(0, 6);
}
if(mac_oui == "")
continue;
if(typeof stat_data[mac_oui] === "undefined")
stat_data[mac_oui] = {};