Skip to content

Commit

Permalink
fix: app crashes (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityastic authored Feb 9, 2020
1 parent 48fa7b0 commit aa4deb3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ class SettingsFragment : BaseFragment() {
Snackbar
.make(view, requireContext().getString(R.string.change_language), Snackbar.LENGTH_INDEFINITE)
.setAction("RESTART") {
requireActivity().finishAffinity()
startActivity(requireActivity().intent)

activity?.let {
it.finishAffinity()
startActivity(requireActivity().intent)
}
}
.show()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class SavedClipartViewModel(
fun getStorageClipartLiveData() = clipArtService.getClipsFromStorage()

fun deleteClipart(position: Int) {
clipArtService.deleteClipart(cliparts[position].fileName)
if (cliparts.isNotEmpty() && position < cliparts.size)
clipArtService.deleteClipart(cliparts[position].fileName)
}

fun setList(list: List<SavedClipart>) {
Expand Down

0 comments on commit aa4deb3

Please # to comment.