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

Commit 8b85f837 authored by Stefan Andonian's avatar Stefan Andonian
Browse files

Add null check for NPE in FolderIcon.

Bug: 265298513
Test: N/A
Change-Id: Id55bd488c40edcca376df2843b1a1999aeb944be
parent 1eb59d6c
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.launcher3.Alarm;
import com.android.launcher3.BubbleTextView;
@@ -181,8 +182,11 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
        return icon;
    }

    public static FolderIcon inflateIcon(int resId, ActivityContext activity, ViewGroup group,
            FolderInfo folderInfo) {
    /**
     * Builds a FolderIcon to be added to the Launcher
     */
    public static FolderIcon inflateIcon(int resId, ActivityContext activity,
            @Nullable ViewGroup group, FolderInfo folderInfo) {
        @SuppressWarnings("all") // suppress dead code warning
        final boolean error = INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION;
        if (error) {
@@ -192,8 +196,10 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
        }

        DeviceProfile grid = activity.getDeviceProfile();
        FolderIcon icon = (FolderIcon) LayoutInflater.from(group.getContext())
                .inflate(resId, group, false);
        LayoutInflater inflater = (group != null)
                ? LayoutInflater.from(group.getContext())
                : activity.getLayoutInflater();
        FolderIcon icon = (FolderIcon) inflater.inflate(resId, group, false);

        icon.setClipToPadding(false);
        icon.mFolderName = icon.findViewById(R.id.folder_icon_name);