Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/lib-finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ function find(name)
case 'linux':
return (require('monitor-info').getLibInfo(name));
break;
default:
return ([]);
}
}

Comment on lines 43 to 50

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 lib-finder.js dispatches on process.platform without a default/other-platform branch, silently returning undefined

Added a default: case to the switch(process.platform) statement in find() that returns an empty array [], matching the platform-stub convention of returning a safe empty value instead of falling through and returning undefined. This ensures callers iterating over the return value on unsupported platforms (win32, darwin, etc.) receive an empty array rather than throwing a TypeError.

(Automatically downgraded: no change in this fix lands near this finding's line — verify whether it was actually addressed.)

🤖 Prompt for AI agents
In modules/lib-finder.js around line 17, review and complete this code-review fix: lib-finder.js dispatches on process.platform without a default/other-platform branch, silently returning undefined.
What the draft fix changed: Added a `default:` case to the `switch(process.platform)` statement in `find()` that returns an empty array `[]`, matching the platform-stub convention of returning a safe empty value instead of falling through and returning `undefined`. This ensures callers iterating over the return value on unsupported platforms (win32, darwin, etc.) receive an empty array rather than throwing a TypeError.

_(Automatically downgraded: no change in this fix lands near this finding's line — verify whether it was actually addressed.)_
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.

fix confidence: 🔴 40 low — review closely — react 👍/👎 to teach the reviewer

Expand Down Expand Up @@ -74,3 +76,4 @@ function findBinary(bin)
module.exports = find;
module.exports.hasBinary = hasBinary;
module.exports.findBinary = findBinary;