Avoid crash on loading invalid extension

This commit is contained in:
arkon 2020-02-23 21:51:55 -05:00
parent 978ac50015
commit 460fbb18c7

View File

@ -100,6 +100,12 @@ internal object ExtensionLoader {
val versionName = pkgInfo.versionName
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
val majorLibVersion = versionName.substringBefore('.').toInt()
if (majorLibVersion < LIB_VERSION_MIN || majorLibVersion > LIB_VERSION_MAX) {