Skip to content

Commit

Permalink
fix: crash caused by racing condition in context access
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Feb 8, 2023
1 parent 628bf83 commit b9e0f09
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,18 @@ class PreferenceGroupFragment : PreferenceFragmentCompat() {
liveprogEdit?.isEnabled = filePresent

liveprogParams?.isEnabled = count > 0
liveprogParams?.summary = if(count > 0)
resources.getQuantityString(R.plurals.custom_parameters, count, count)
else
getString(R.string.liveprog_additional_params_not_supported)

try {
liveprogParams?.summary = if (count > 0)
resources.getQuantityString(R.plurals.custom_parameters, count, count)
else
getString(R.string.liveprog_additional_params_not_supported)
}
catch(ex: IllegalStateException) {
/* Because this lambda is executed async, it is possible that it is called
while the fragment is destroyed, leading to accessing a detached context */
Timber.d(ex)
}
}

if (recyclerView == null)
Expand Down

0 comments on commit b9e0f09

Please sign in to comment.