Skip to content

Commit 4f8ee70

Browse files
committed
Handle empty JSON
1 parent 6433172 commit 4f8ee70

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

helper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,12 @@ public function getPages($schema = null)
201201
* @param string $value
202202
* @return mixed
203203
* @throws StructException
204+
* @throws JsonException
204205
*/
205206
public static function decodeJson($value)
206207
{
207-
if (!empty($value) && $value[0] !== '[') throw new StructException('Lookup expects JSON');
208+
if (empty($value)) return $value;
209+
if ($value[0] !== '[') throw new StructException('Lookup expects JSON');
208210
return json_decode($value, null, 512, JSON_THROW_ON_ERROR);
209211
}
210212
}

0 commit comments

Comments
 (0)