Skip to content

Commit

Permalink
dustin10#1308 Handle empty dimensions array case (dustin10#1309)
Browse files Browse the repository at this point in the history
When normalizing the File the `getWidth` and `getHeight` are called and while the dimension for null files is returned as an empty array the original check is not enough to handle this case.
  • Loading branch information
krstns authored Jul 30, 2022
1 parent 371e509 commit 3322ab3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Entity/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function setDimensions(?array $dimensions): void
*/
public function getWidth(): ?int
{
return null !== $this->dimensions ? $this->dimensions[0] : null;
return $this->dimensions[0] ?? null;
}

/**
Expand All @@ -98,7 +98,7 @@ public function getWidth(): ?int
*/
public function getHeight(): ?int
{
return null !== $this->dimensions ? $this->dimensions[1] : null;
return $this->dimensions[1] ?? null;
}

/**
Expand Down

0 comments on commit 3322ab3

Please sign in to comment.