mirror of
https://github.com/werkraum-media/thuecat.git
synced 2024-12-04 19:16:13 +01:00
Fix PHP Warning (#92)
First check for existence before accessing. The ObjectStorage itself has no check which will result in an PHP warning due to accessing a none existing array key. Relates: #10197
This commit is contained in:
parent
928f42e7fc
commit
45eda76e98
1 changed files with 5 additions and 2 deletions
|
@ -95,8 +95,11 @@ class ImportConfiguration extends AbstractEntity implements ImportConfigurationI
|
|||
|
||||
public function getLastImported(): ?\DateTimeImmutable
|
||||
{
|
||||
$positionOfLastLog = count($this->logs) - 1;
|
||||
$lastImport = $this->logs->offsetGet((string) $positionOfLastLog);
|
||||
$lastImport = null;
|
||||
$positionOfLastLog = (string) (count($this->logs) - 1);
|
||||
if ($this->logs->offsetExists($positionOfLastLog)) {
|
||||
$lastImport = $this->logs->offsetGet($positionOfLastLog);
|
||||
}
|
||||
if (!$lastImport instanceof ImportLog) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue