Skip to content

Commit

Permalink
Fix null (#47)
Browse files Browse the repository at this point in the history
* Gracefully handle null values in convertToUTF8
  • Loading branch information
kamil4 authored Jul 2, 2022
1 parent 777b74f commit fcfa13e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/PHPExif/Adapter/AdapterAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ public function setOptions(array $options) : AdapterInterface
public function convertToUTF8(array|string $data) : array|string
{
if (is_array($data)) {
/** @var array|string $v */
/** @var array|string|null $v */
foreach ($data as $k => $v) {
$data[$k] = $this->convertToUTF8($v);
if ($v !== null) {
$data[$k] = $this->convertToUTF8($v);
}
}
} else {
$data = Encoding::toUTF8($data);
Expand Down

0 comments on commit fcfa13e

Please sign in to comment.