diff --git a/src/com/android/settings/slices/SliceBuilderUtils.java b/src/com/android/settings/slices/SliceBuilderUtils.java
index a56a290..c1c3b8e8 100644
--- a/src/com/android/settings/slices/SliceBuilderUtils.java
+++ b/src/com/android/settings/slices/SliceBuilderUtils.java
@@ -49,6 +49,7 @@
 import java.util.List;
 import java.util.stream.Collectors;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.core.graphics.drawable.IconCompat;
 import androidx.slice.Slice;
 import androidx.slice.builders.ListBuilder;
@@ -242,7 +243,7 @@
     private static Slice buildToggleSlice(Context context, SliceData sliceData,
             BasePreferenceController controller) {
         final PendingIntent contentIntent = getContentPendingIntent(context, sliceData);
-        final IconCompat icon = IconCompat.createWithResource(context, sliceData.getIconResource());
+        final IconCompat icon = getSafeIcon(context, sliceData);
         final CharSequence subtitleText = getSubtitleText(context, controller, sliceData);
         @ColorInt final int color = Utils.getColorAccentDefaultColor(context);
         final TogglePreferenceController toggleController =
@@ -266,7 +267,7 @@
     private static Slice buildIntentSlice(Context context, SliceData sliceData,
             BasePreferenceController controller) {
         final PendingIntent contentIntent = getContentPendingIntent(context, sliceData);
-        final IconCompat icon = IconCompat.createWithResource(context, sliceData.getIconResource());
+        final IconCompat icon = getSafeIcon(context, sliceData);
         final CharSequence subtitleText = getSubtitleText(context, controller, sliceData);
         @ColorInt final int color = Utils.getColorAccentDefaultColor(context);
         final List<String> keywords = buildSliceKeywords(sliceData);
@@ -287,7 +288,7 @@
         final SliderPreferenceController sliderController = (SliderPreferenceController) controller;
         final PendingIntent actionIntent = getSliderAction(context, sliceData);
         final PendingIntent contentIntent = getContentPendingIntent(context, sliceData);
-        final IconCompat icon = IconCompat.createWithResource(context, sliceData.getIconResource());
+        final IconCompat icon = getSafeIcon(context, sliceData);
         @ColorInt final int color = Utils.getColorAccentDefaultColor(context);
         final CharSequence subtitleText = getSubtitleText(context, controller, sliceData);
         final SliceAction primaryAction = new SliceAction(contentIntent, icon,
@@ -382,4 +383,14 @@
                 .setKeywords(keywords)
                 .build();
     }
+
+    @VisibleForTesting
+    static IconCompat getSafeIcon(Context context, SliceData data) {
+        int iconResource = data.getIconResource();
+
+        if (iconResource == 0) {
+            iconResource = R.drawable.ic_settings;
+        }
+        return IconCompat.createWithResource(context, iconResource);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java b/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java
index ed33a80..b96c128 100644
--- a/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java
@@ -48,8 +48,11 @@
 import org.mockito.ArgumentCaptor;
 import org.robolectric.RuntimeEnvironment;
 
+import androidx.core.graphics.drawable.IconCompat;
 import androidx.slice.Slice;
+import androidx.slice.SliceMetadata;
 import androidx.slice.SliceProvider;
+import androidx.slice.core.SliceAction;
 import androidx.slice.widget.SliceLiveData;
 
 @RunWith(SettingsRobolectricTestRunner.class)
@@ -406,27 +409,92 @@
         assertThat(intentData).isEqualTo(expectedUri);
     }
 
+    @Test
+    public void buildIntentSlice_noIconPassed_returnsSliceWithIcon() {
+        final int expectedIconResource = IconCompat.createWithResource(mContext,
+                R.drawable.ic_settings).toIcon().getResId();
+        final SliceData sliceData = getDummyData(CONTEXT_CONTROLLER, SliceData.SliceType.INTENT,
+                0x0);
+
+        final Slice slice = SliceBuilderUtils.buildSlice(mContext, sliceData);
+
+        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
+        final SliceAction primaryAction = metadata.getPrimaryAction();
+        final int actualIconResource = primaryAction.getIcon().toIcon().getResId();
+        assertThat(actualIconResource).isEqualTo(expectedIconResource);
+    }
+
+    @Test
+    public void buildToggleSlice_noIconPassed_returnsSliceWithIcon() {
+        final int expectedIconResource = IconCompat.createWithResource(mContext,
+                R.drawable.ic_settings).toIcon().getResId();
+        final SliceData dummyData = getDummyData(TOGGLE_CONTROLLER, SliceData.SliceType.SWITCH,
+                0x0);
+
+        final Slice slice = SliceBuilderUtils.buildSlice(mContext, dummyData);
+
+        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
+        final SliceAction primaryAction = metadata.getPrimaryAction();
+        final int actualIconResource = primaryAction.getIcon().toIcon().getResId();
+        assertThat(actualIconResource).isEqualTo(expectedIconResource);
+    }
+
+    @Test
+    public void buildSliderSlice_noIconPassed_returnsSliceWithIcon() {
+        final int expectedIconResource = IconCompat.createWithResource(mContext,
+                R.drawable.ic_settings).toIcon().getResId();
+        final SliceData data = getDummyData(SLIDER_CONTROLLER, SliceData.SliceType.SLIDER, 0x0);
+
+        final Slice slice = SliceBuilderUtils.buildSlice(mContext, data);
+
+        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
+        final SliceAction primaryAction = metadata.getPrimaryAction();
+        final int actualIconResource = primaryAction.getIcon().toIcon().getResId();
+        assertThat(actualIconResource).isEqualTo(expectedIconResource);
+    }
+
+    @Test
+    public void getSafeIcon_replacesEmptyIconWithSettingsIcon() {
+        final int settingsIcon = R.drawable.ic_settings;
+        final int zeroIcon = 0x0;
+        final SliceData data = getDummyData(TOGGLE_CONTROLLER, SliceData.SliceType.SWITCH,
+                zeroIcon);
+
+        final IconCompat actualIcon = SliceBuilderUtils.getSafeIcon(mContext, data);
+
+        final int actualIconResource = actualIcon.toIcon().getResId();
+        assertThat(actualIconResource).isNotEqualTo(zeroIcon);
+        assertThat(actualIconResource).isEqualTo(settingsIcon);
+    }
+
     private SliceData getDummyData() {
-        return getDummyData(TOGGLE_CONTROLLER, SUMMARY, SliceData.SliceType.SWITCH, SCREEN_TITLE);
+        return getDummyData(TOGGLE_CONTROLLER, SUMMARY, SliceData.SliceType.SWITCH, SCREEN_TITLE,
+                ICON);
+    }
+
+    private SliceData getDummyData(Class prefController, int sliceType, int icon) {
+        return getDummyData(TOGGLE_CONTROLLER, SUMMARY, SliceData.SliceType.SWITCH, SCREEN_TITLE,
+                icon);
     }
 
     private SliceData getDummyData(String summary, String screenTitle) {
-        return getDummyData(TOGGLE_CONTROLLER, summary, SliceData.SliceType.SWITCH, screenTitle);
+        return getDummyData(TOGGLE_CONTROLLER, summary, SliceData.SliceType.SWITCH, screenTitle,
+                ICON);
     }
 
     private SliceData getDummyData(Class prefController, int sliceType) {
-        return getDummyData(prefController, SUMMARY, sliceType, SCREEN_TITLE);
+        return getDummyData(prefController, SUMMARY, sliceType, SCREEN_TITLE, ICON);
     }
 
     private SliceData getDummyData(Class prefController, String summary, int sliceType,
-            String screenTitle) {
+            String screenTitle, int icon) {
         return new SliceData.Builder()
                 .setKey(KEY)
                 .setTitle(TITLE)
                 .setSummary(summary)
                 .setScreenTitle(screenTitle)
                 .setKeywords(KEYWORDS)
-                .setIcon(ICON)
+                .setIcon(icon)
                 .setFragmentName(FRAGMENT_NAME)
                 .setUri(URI)
                 .setPreferenceControllerClassName(prefController.getName())
