Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
Don't send error if SerialPort.list fails (Fixes #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Mar 4, 2019
1 parent 24e9631 commit 7e247b2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,9 @@ app.get('/api/settings', function(req, res) {
SerialPort.list(function (err, ports) {
if (err) {
debug(err);
res.json({success:false, message: "Error getting serial ports", serial_ports:[]});
}else{
var devices = gw.zwave ? gw.zwave.devices : {};
res.json({success:true, settings: jsonStore.get(store.settings), devices: devices, serial_ports: ports.map(p => p.comName)});
}
var devices = gw.zwave ? gw.zwave.devices : {};
res.json({success:true, settings: jsonStore.get(store.settings), devices: devices, serial_ports: ports ? ports.map(p => p.comName) : []});
})
});

Expand Down

0 comments on commit 7e247b2

Please sign in to comment.