From ffeed85befa4119c5c3b2ec378d46e8af8838840 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Thu, 16 Sep 2021 04:13:14 +0200
Subject: [PATCH] Continued: - readCsvFileLine() returns a non-array (currently
 NULL) when the end-of-file   has been reached, this needs to be respected
 here.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Signed-off-by: Roland Häder <roland@mxchange.org>
---
 .../source/urls/class_CrawlerUploadedListUrlSource.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php
index d9cfeb9be..7a5bf1a88 100644
--- a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php
+++ b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php
@@ -305,8 +305,16 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R
 		// Read full "CSV line"
 		$csvData = $csvFileInstance->readCsvFileLine($this->columnSeparator, self::CRAWL_ENTRY_SIZE);
 
+		// Is $csvData set?
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: csvData[]=%s', gettype($csvData)));
+		if (!is_array($csvData)) {
+			// Is not array, then reading the file has reached EOF
+			/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: EXIT!');
+			return;
+		}
+
 		// Is the array empty?
-		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: csvData[%s]=%s', gettype($csvData), print_r($csvData, TRUE)));
+		/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: csvData(%d)=%s', count($csvData), print_r($csvData, TRUE)));
 		if (count($csvData) == 0) {
 			// Try to close it by actually unsetting (destructing) it
 			/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: File "%s" has been fully read.', $csvFileInstance->getFilename()));
-- 
2.39.5