catch all exceptions at toggling favorites
This commit is contained in:
parent
ee124506e8
commit
352dbe40bf
|
@ -847,15 +847,15 @@ fun Context.getFavoritePaths(): ArrayList<String> {
|
||||||
fun Context.getFavoriteFromPath(path: String) = Favorite(null, path, path.getFilenameFromPath(), path.getParentPath())
|
fun Context.getFavoriteFromPath(path: String) = Favorite(null, path, path.getFilenameFromPath(), path.getParentPath())
|
||||||
|
|
||||||
fun Context.updateFavorite(path: String, isFavorite: Boolean) {
|
fun Context.updateFavorite(path: String, isFavorite: Boolean) {
|
||||||
if (isFavorite) {
|
|
||||||
try {
|
try {
|
||||||
|
if (isFavorite) {
|
||||||
favoritesDB.insert(getFavoriteFromPath(path))
|
favoritesDB.insert(getFavoriteFromPath(path))
|
||||||
} catch (e: Exception) {
|
|
||||||
toast(R.string.unknown_error_occurred)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
favoritesDB.deleteFavoritePath(path)
|
favoritesDB.deleteFavoritePath(path)
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
toast(R.string.unknown_error_occurred)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the "recycle_bin" from the file path prefix, replace it with real bin path /data/user...
|
// remove the "recycle_bin" from the file path prefix, replace it with real bin path /data/user...
|
||||||
|
|
Loading…
Reference in New Issue