Skip to content

Commit

Permalink
Merge pull request #117 from particle-iot/fix/safe-platform-access
Browse files Browse the repository at this point in the history
Read Vendor ID and Product ID for Tachyon and Linux
  • Loading branch information
keeramis authored Jan 10, 2025
2 parents 1914154 + 10af3c5 commit 2f2f633
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
},
"devDependencies": {
"@particle/async-utils": "^4.0.2",
"@particle/device-constants": "^3.6.0",
"@particle/device-constants": "^3.7.0",
"buffer": "^6.0.3",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
Expand Down
8 changes: 4 additions & 4 deletions src/device-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,10 @@ async function getDevices({ types = [], includeDfu = true } = {}) {
const filters = [];
PLATFORMS.forEach((platform) => {
if (types.length === 0 || types.includes(platform.name)) {
if (platform.usb.vendorId) {
if (platform && platform.usb && platform.usb.vendorId) {
filters.push(platform.usb);
}
if (includeDfu && platform.dfu.vendorId) {
if (includeDfu && platform && platform.dfu && platform.dfu.vendorId) {
filters.push(platform.dfu);
}
}
Expand All @@ -765,10 +765,10 @@ async function openDeviceById(id, options = null) {
const log = globalOptions.log;
const filters = [];
PLATFORMS.forEach((platform) => {
if (platform.usb.vendorId) {
if (platform && platform.usb && platform.usb.vendorId) {
filters.push(Object.assign({ serialNumber: id }, platform.usb));
}
if (platform.dfu.vendorId) {
if (platform && platform.dfu && platform.dfu.vendorId) {
filters.push(Object.assign({ serialNumber: id }, platform.dfu));
}
});
Expand Down

0 comments on commit 2f2f633

Please sign in to comment.