From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alisher Alikhodjaev <alisher@google.com>
Date: Tue, 2 Aug 2022 13:32:30 -0700
Subject: [PATCH] The length of a packet should be non-zero

Bug: 221856662
Bug: 237079835
Test: no functional changes, the build is ok
Change-Id: I6defe4025c962ae7dde2e673e2bfcfc15785cc12
(cherry picked from commit 396ac0e081ae67a1d743e0373257ec869692912c)
Merged-In: I6defe4025c962ae7dde2e673e2bfcfc15785cc12
[basilgello: Backport to LineageOS 14.1: adjust context]
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
---
 src/nfc/nfc/nfc_ncif.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/nfc/nfc/nfc_ncif.c b/src/nfc/nfc/nfc_ncif.c
index dd89d46..3f67d86 100644
--- a/src/nfc/nfc/nfc_ncif.c
+++ b/src/nfc/nfc/nfc_ncif.c
@@ -1135,13 +1135,14 @@ void nfc_ncif_proc_ee_discover_req (UINT8 *p, UINT16 plen)
     tNFC_EE_DISCOVER_INFO       *p_info;
     UINT8                       u8;
 
-    NFC_TRACE_DEBUG2 ("nfc_ncif_proc_ee_discover_req %d len:%d", *p, plen);
     if (!plen)
     {
         android_errorWriteLog(0x534e4554, "221856662");
         return;
     }
 
+    NFC_TRACE_DEBUG2 ("nfc_ncif_proc_ee_discover_req %d len:%d", *p, plen);
+
     if (p_cback)
     {
         u8  = *p;
