Avoid crash on loading invalid extension
(cherry picked from commit 460fbb18c7
)
This commit is contained in:
parent
72920130c0
commit
3aa12281c3
1 changed files with 6 additions and 0 deletions
|
@ -100,6 +100,12 @@ internal object ExtensionLoader {
|
||||||
val versionName = pkgInfo.versionName
|
val versionName = pkgInfo.versionName
|
||||||
val versionCode = pkgInfo.versionCode
|
val versionCode = pkgInfo.versionCode
|
||||||
|
|
||||||
|
if (versionName.isNullOrEmpty()) {
|
||||||
|
val exception = Exception("Missing versionName for extension $extName")
|
||||||
|
Timber.w(exception)
|
||||||
|
return LoadResult.Error(exception)
|
||||||
|
}
|
||||||
|
|
||||||
// Validate lib version
|
// Validate lib version
|
||||||
val majorLibVersion = versionName.substringBefore('.').toInt()
|
val majorLibVersion = versionName.substringBefore('.').toInt()
|
||||||
if (majorLibVersion < LIB_VERSION_MIN || majorLibVersion > LIB_VERSION_MAX) {
|
if (majorLibVersion < LIB_VERSION_MIN || majorLibVersion > LIB_VERSION_MAX) {
|
||||||
|
|
Reference in a new issue