Skip to content

Commit

Permalink
fix(networkInterface): make sure to check networkInterface is defined
Browse files Browse the repository at this point in the history
This is one of the potential bugs, at least, one of the customers has already reported. The test coverage is going to be added later in different Pull Request.

Semver: patch

fix(lint): fix linting issues
  • Loading branch information
Samir Musali committed Aug 12, 2020
1 parent 724cebb commit f985a41
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ if ((os.platform() === 'win32' && require('is-administrator')()) || process.getu
interface.address.startsWith('192.168.'));
})[0];

if (networkInterface.mac) { config.mac = networkInterface.mac; }
if (networkInterface.address) { config.ip = networkInterface.address; }
if (networkInterface) {
if (networkInterface.mac) { config.mac = networkInterface.mac; }
if (networkInterface.address) { config.ip = networkInterface.address; }
}

utils.log(`${config.package} started on ${config.hostname} (${config.ip})`);
if (config.platform && config.platform.startsWith('k8s')) { k8s.init(); }
Expand Down

0 comments on commit f985a41

Please sign in to comment.