Skip to content

Commit 20eb2db

Browse files
fix potential bug
1 parent b0d3827 commit 20eb2db

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

src/Brickner/Podsumer/State.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,14 @@ public function setPlaybackPosition(int $item_id, int $position): void
357357
public function getPlaybackPosition(int $item_id): int
358358
{
359359
$sql = 'SELECT playback_position FROM items WHERE id = :id';
360-
$pos = $this->query($sql, ['id' => $item_id])[0]['playback_position'] ?? 0;
360+
$result = $this->query($sql, ['id' => $item_id]);
361361

362-
return intval($pos);
362+
// If the query helper returned false or an empty result set, default to 0
363+
if (false === $result || empty($result) || !isset($result[0]['playback_position'])) {
364+
return 0;
365+
}
366+
367+
return intval($result[0]['playback_position']);
363368
}
364369

365370
protected function loadFile(string $filename): string

0 commit comments

Comments
 (0)