Skip to content

Commit

Permalink
Update disklist.js
Browse files Browse the repository at this point in the history
bugfix: Added check to make sure that driveLettersArray is not empty before trying to get drive names.
  • Loading branch information
fishylunar committed Oct 25, 2024
1 parent a0b8062 commit eb1ee41
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/🐟/disklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,14 @@ class Helpers {
}

static getDriveLetter(index) {
driveLettersArray.forEach(dl => { // If no drive name, set the name to Unnamed Drive
if (dl.Label === null) dl.Label = "Unnamed Disk";
});
return driveLettersArray[index];
if (driveLettersArray.length > 0) {
driveLettersArray.forEach(dl => { // If no drive name, set the name to Unnamed Drive
if (dl.Label === null) dl.Label = "Unnamed Disk";
});
return driveLettersArray[index];
}
}

static getDriveDescription(deviceName) {
try {
const udevadmOutput = execSync(`udevadm info --query=property --name=${deviceName}`).toString();
Expand Down

0 comments on commit eb1ee41

Please sign in to comment.