Fix warnings from static analysis tool.

1.NULL_RETURNS:
  a. format()
  Null pointer check is added before calling Tag object's method.

Bug: 275291562
Test: Build ok
Change-Id: Idb1462585ad9225e6e026608190a1b4a5de68713
This commit is contained in:
sai.shwethas
2023-04-03 12:14:34 +05:30
committed by Sai Shweta S
parent dee01562d0
commit 0d7ad87362

View File

@@ -124,6 +124,9 @@ public final class NdefFormatable extends BasicTagTechnology {
try {
int serviceHandle = mTag.getServiceHandle();
INfcTag tagService = mTag.getTagService();
if (tagService == null) {
throw new IOException();
}
int errorCode = tagService.formatNdef(serviceHandle, MifareClassic.KEY_DEFAULT);
switch (errorCode) {
case ErrorCodes.SUCCESS: