Skip to content

Commit

Permalink
Merge pull request #545 from mikepenz/fix/543
Browse files Browse the repository at this point in the history
Fallback to licenseId if no licenseIds are specified
  • Loading branch information
mikepenz committed Oct 27, 2020
2 parents d2e650c + 8c5fa09 commit f8f3ec2
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -376,7 +376,7 @@ class Libs(
licenseDescription
)
} catch (ex: Exception) {
Log.e("aboutlibraries", "Failed to generateLicense from file: " + ex.toString())
Log.e("aboutlibraries", "Failed to generateLicense from file: $ex")
null
}
}
Expand All @@ -402,7 +402,8 @@ class Libs(
lib.libraryWebsite = ctx.getStringResourceByName("library_" + name + "_libraryWebsite")

val licenseIds = ctx.getStringResourceByName("library_" + name + "_licenseIds")
if (licenseIds.isBlank()) {
val legacyLicenseId = ctx.getStringResourceByName("library_" + name + "_licenseId")
if (licenseIds.isBlank() && legacyLicenseId.isBlank()) {
val license = License("",
ctx.getStringResourceByName("library_" + name + "_licenseVersion"),
ctx.getStringResourceByName("library_" + name + "_licenseLink"),
Expand All @@ -412,7 +413,7 @@ class Libs(
lib.licenses = setOf(license)
} else {
val licenses = mutableSetOf<License>()
licenseIds.split(",").onEach { licenseId ->
(if (licenseIds.isBlank()) listOf(legacyLicenseId) else licenseIds.split(",")).onEach { licenseId ->
var license = getLicense(licenseId)
if (license != null) {
license = license.copy()
Expand Down

0 comments on commit f8f3ec2

Please sign in to comment.