Commit e95ea7ed authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Apps: Add safe, non-null, and let assertions as needed



- gradle gives compile-time errors otherwise
Signed-off-by: Aayush Gupta's avatarAayush Gupta <theimpulson@e.email>
parent df682dd0
......@@ -141,7 +141,7 @@ class Installer(private val packageName: String,
private var receiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == Intent.ACTION_PACKAGE_ADDED &&
(intent.data.encodedSchemeSpecificPart == packageName)) {
(intent.data?.encodedSchemeSpecificPart == packageName)) {
Log.i(TAG, "Broadcast received")
var path = apk.absolutePath.split("Download")
//delete all APK file after install
......
......@@ -35,7 +35,7 @@ class UpdatesManager(applicationContext: Context) {
automaticUpdateInterval =
preferences.getString(
applicationContext.getString(R.string.pref_update_interval_key),
applicationContext.getString(R.string.preference_update_interval_default))
applicationContext.getString(R.string.preference_update_interval_default))!!
.toInt()
}
......
......@@ -92,7 +92,7 @@ object Common {
}
fun appHasLaunchActivity(context: Context, packageName: String?): Boolean {
return (context.packageManager.getLaunchIntentForPackage(packageName) != null)
return (packageName?.let { context.packageManager.getLaunchIntentForPackage(it) } != null)
}
fun getObjectMapper(): ObjectMapper {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment