Skip to content

Commit

Permalink
fix: crash when attempting to load a preset file that is a folder
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Mar 8, 2023
1 parent 4f72e53 commit f5bed12
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ class Preset(val name: String): KoinComponent {
fun load(): PresetMetadata? {
val file = file()
Timber.d("Loading preset from ${file.path}")
return load(ctx, FileInputStream(file))
return load(
ctx,
try { FileInputStream(file) }
catch(ex: Exception) {
Timber.e(ex)
return null
}
)
}

fun save(): Boolean {
Expand Down

0 comments on commit f5bed12

Please sign in to comment.