diff --git a/services/core/java/com/android/server/am/AppErrors.java b/services/core/java/com/android/server/am/AppErrors.java index 1f156dfd19851..7eff773543c8f 100644 --- a/services/core/java/com/android/server/am/AppErrors.java +++ b/services/core/java/com/android/server/am/AppErrors.java @@ -638,7 +638,8 @@ class AppErrors { // Allow restarting for started or bound foreground services that are crashing the // first time. This includes wallpapers. - if (sr.crashCount <= 1 && (sr.isForeground || procIsBoundForeground)) { + if ((data != null) && (sr.crashCount <= 1) + && (sr.isForeground || procIsBoundForeground)) { data.isRestartableForService = true; } }