Add null checking to fix NullPointerException while creating mock tag
Bug: 221452261
Test: Test pass
Change-Id: Ie64df0d8d291468b258f92524af10da504c7dade
Merged_In: Ie64df0d8d291468b258f92524af10da504c7dade
(cherry picked from commit dbdc1bd3c7)
This commit is contained in:
@@ -142,9 +142,13 @@ public final class Tag implements Parcelable {
|
||||
mTagService = tagService;
|
||||
|
||||
mConnectedTechnology = -1;
|
||||
mCookie = SystemClock.elapsedRealtime();
|
||||
|
||||
if (tagService == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
mCookie = SystemClock.elapsedRealtime();
|
||||
tagService.setTagUpToDate(mCookie);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowAsRuntimeException();
|
||||
@@ -370,6 +374,10 @@ public final class Tag implements Parcelable {
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage
|
||||
public INfcTag getTagService() {
|
||||
if (mTagService == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!mTagService.isTagUpToDate(mCookie)) {
|
||||
String id_str = "";
|
||||
|
||||
Reference in New Issue
Block a user