Skip to content

Commit

Permalink
✅ Add null check in TopActivityFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-rasevych-criteo committed Feb 27, 2023
1 parent ab01b75 commit ed18c99
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class TopActivityFinder(private val context: Context) {
// The getRunningTasks may return information about an activity that the host application does
// not own, but that is safe to share. This is the cases for launchers. So we need to filter on
// activities that looks like our own ones.
val topActivityName = taskInfo[0].topActivity
return if (topActivityName!!.packageName.startsWith(context.packageName)) {
val topActivityName = taskInfo.firstOrNull()?.topActivity
return if (topActivityName?.packageName?.startsWith(context.packageName) == true) {
topActivityName
} else null
}
Expand Down

0 comments on commit ed18c99

Please sign in to comment.