Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined forEach for fields section if it doesn't have any values #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
37 changes: 22 additions & 15 deletions KiCad_BOM_Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,15 @@ function ExtractAndGenerateDataForThePart () {
UserProjectNetData.export.components[0].comp.forEach(function (Part) {
if (Part.fields) {
Part.fields.forEach(function (value) {
value.field.forEach(function (value) {
if (ListOfFields.indexOf(value.$.name) === -1) {
// if the returned index is -1 then we know that we know we don't have this item
ListOfFields.push(value.$.name)
}
})
if(value.field){
value.field.forEach(function (value) {
if (ListOfFields.indexOf(value.$.name) === -1) {
// if the returned index is -1 then we know that we know we don't have this item
ListOfFields.push(value.$.name)
}
})
}

})
}
})
Expand All @@ -338,9 +341,11 @@ function ExtractAndGenerateDataForThePart () {

if (Part.fields) {
Part.fields.forEach(function (value) {
value.field.forEach(function (value) {
TempFieldHolder[value.$.name] = value['_']
})
if(value.field){
value.field.forEach(function (value) {
TempFieldHolder[value.$.name] = value['_']
})
}
})
}

Expand All @@ -365,12 +370,14 @@ function ExtractAndGenerateDataForThePart () {

if (Part.fields) {
Part.fields.forEach(function (value) {
value.field.forEach(function (value) {
if (ListOfFields.indexOf(value.$.name) === -1) {
// if the returned index is -1 then we know that we know we don't have this item
ListOfFields.push(value.$.name)
}
})
if(value.field){
value.field.forEach(function (value) {
if (ListOfFields.indexOf(value.$.name) === -1) {
// if the returned index is -1 then we know that we know we don't have this item
ListOfFields.push(value.$.name)
}
})
}
})
}

Expand Down