Skip to content

Commit c146180

Browse files
committed
comment
1 parent cce5c85 commit c146180

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

common/src/main/java/com/microsoft/identity/common/adal/internal/PowerManagerWrapper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ public String isAppOptedOutFromBatteryOptimization(@NonNull final String package
154154

155155
return batteryOptOutCache.computeIfAbsent(packageName, key -> {
156156
try {
157-
final PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
157+
final PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);if (powerManager == null) {
158+
Logger.error(methodTag, "PowerManager is null for package: " + packageName, null);
159+
return "CannotRetrievePowerManager";
160+
}
161+
158162
if (powerManager.isIgnoringBatteryOptimizations(key)) {
159163
return "OptOut";
160164
} else {

0 commit comments

Comments
 (0)