mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
fix: return fallback value when versionName is null
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
12130f5521
commit
632d8f6804
1 changed files with 3 additions and 1 deletions
|
|
@ -14,7 +14,9 @@ object ConfigUtils {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
private fun Context.getVersionName(): String? =
|
private fun Context.getVersionName(): String? =
|
||||||
try {
|
try {
|
||||||
packageManager.getPackageInfo(packageName, 0).versionName
|
private fun Context.getVersionName(): String =
|
||||||
|
try {
|
||||||
|
packageManager.getPackageInfo(packageName, 0).versionName ?: BuildConfig.VERSION_NAME
|
||||||
} catch (e: PackageManager.NameNotFoundException) {
|
} catch (e: PackageManager.NameNotFoundException) {
|
||||||
BuildConfig.VERSION_NAME
|
BuildConfig.VERSION_NAME
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue