Add logging for potential NPE

This commit is contained in:
tzugen 2023-03-21 09:55:11 +01:00
parent 46ad240306
commit be55eb514c
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
3 changed files with 7 additions and 5 deletions

View File

@ -31,5 +31,4 @@ if (isCodeQualityEnabled) {
}
tasks.detekt.jvmTarget = "11"
}
}

View File

@ -600,14 +600,17 @@ open class TrackCollectionFragment(
listModel.getRandom(size, append)
} else {
setTitle(name)
requireNotNull(id) {
"ID must be set. NavArgs: ${navArgs.toBundle()}"
}
if (ActiveServerProvider.isID3Enabled()) {
if (isAlbum) {
listModel.getAlbum(refresh2, id!!, name)
listModel.getAlbum(refresh2, id, name)
} else {
throw IllegalAccessException("Use AlbumFragment instead!")
}
} else {
listModel.getMusicDirectory(refresh2, id!!, name)
listModel.getMusicDirectory(refresh2, id, name)
}
}

View File

@ -39,14 +39,14 @@ object CommunicationError {
}
@JvmStatic
fun handleError(error: Throwable?, context: Context?) {
fun handleError(error: Throwable, context: Context?) {
Timber.w(error)
if (context == null) return
ErrorDialog(
context = context,
message = getErrorMessage(error!!, context)
message = getErrorMessage(error, context)
).show()
}