Skip to content

Commit

Permalink
More gracefully handle CSVs will many blank fields
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineOmega committed Jun 1, 2020
1 parent 8e3f550 commit e2bfefb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Objects/Sources/CSVSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getDataRows(int $page = 1, array $fieldsToRetrieve = []): array
$dataRow = new DataRow();

foreach ($line as $key => $value) {
if (in_array($this->fields[$key], $fieldsToRetrieve)) {
if (array_key_exists($key, $this->fields) && in_array($this->fields[$key], $fieldsToRetrieve)) {
$dataRow->addDataItem(new DataItem($this->fields[$key], $value));
}
}
Expand Down

0 comments on commit e2bfefb

Please sign in to comment.