From e2bfefb3e7ccac7c0230564db0c0a9d756918046 Mon Sep 17 00:00:00 2001 From: Jordan Hall Date: Mon, 1 Jun 2020 09:34:27 +0100 Subject: [PATCH] More gracefully handle CSVs will many blank fields --- src/Objects/Sources/CSVSource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Objects/Sources/CSVSource.php b/src/Objects/Sources/CSVSource.php index 3490cd4..83a198c 100755 --- a/src/Objects/Sources/CSVSource.php +++ b/src/Objects/Sources/CSVSource.php @@ -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)); } }