Skip to content

Commit 0d33b8d

Browse files
committed
Decoding null to null is not an error
Quit throwing exceptions when the queue is empty. Change-Id: Ie5479c81c0a6138e1cad416b40d3edabffb1e9c4
1 parent 4355bdb commit 0d33b8d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/PHPQueue/Json.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
class Json {
77
public static function safe_decode( $text ) {
8+
if ( $text === null ) {
9+
return null;
10+
}
811
$data = json_decode($text, true);
912
if ( $data === null ) {
1013
throw new JsonException("JSON could not be decoded: '{$text}'");

0 commit comments

Comments
 (0)