From 1b118cc2cf76ce80a0901f1588f653cc39e8eed6 Mon Sep 17 00:00:00 2001 From: Rodrigo Gonzalez Date: Mon, 20 Mar 2023 12:25:42 -0300 Subject: [PATCH] Check that array is not empty --- src/model/NotificationPayload.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/model/NotificationPayload.php b/src/model/NotificationPayload.php index e3eea84..523982c 100644 --- a/src/model/NotificationPayload.php +++ b/src/model/NotificationPayload.php @@ -86,7 +86,9 @@ class NotificationPayload } $instance->latestExpiredReceipt = $request->input('unified_receipt.latest_expired_receipt'); if ($request->has('unified_receipt.latest_expired_receipt_info')) { - $instance->latestExpiredReceiptInfo = Receipt::createFromArray($request->input('unified_receipt.latest_expired_receipt_info')[0]); + if (count($request->input('unified_receipt.latest_expired_receipt_info')) > 0) { + $instance->latestExpiredReceiptInfo = Receipt::createFromArray($request->input('unified_receipt.latest_expired_receipt_info')[0]); + } } else { $instance->latestExpiredReceiptInfo = null; }