Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbdc1bd3 authored by chloedai's avatar chloedai
Browse files

Add null checking to fix NullPointerException while creating mock tag

Bug: 221452261
Test: Test pass
Change-Id: Ie64df0d8d291468b258f92524af10da504c7dade
parent c742a795
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -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 = "";