1
0
mirror of https://github.com/etesync/android synced 2024-11-26 01:48:34 +00:00

Kotlin: fix some wrong null assertions.

This commit is contained in:
Tom Hacohen 2019-01-05 12:40:22 +00:00
parent c75f2fa7d5
commit 26715f2f34
5 changed files with 6 additions and 6 deletions

View File

@ -111,7 +111,7 @@ constructor(context: Context, account: Account, settings: AccountSettings, extra
} }
val event = events[0] val event = events[0]
val local = localCollection!!.getByUid(event.uid) as LocalEvent val local = localCollection!!.getByUid(event.uid) as LocalEvent?
if (cEntry.isAction(SyncEntry.Actions.ADD) || cEntry.isAction(SyncEntry.Actions.CHANGE)) { if (cEntry.isAction(SyncEntry.Actions.ADD) || cEntry.isAction(SyncEntry.Actions.CHANGE)) {
processEvent(event, local) processEvent(event, local)

View File

@ -163,7 +163,7 @@ constructor(context: Context, account: Account, settings: AccountSettings, extra
App.log.warning("Received multiple VCards, using first one") App.log.warning("Received multiple VCards, using first one")
val contact = contacts[0] val contact = contacts[0]
val local = localCollection!!.getByUid(contact.uid) as LocalResource val local = localCollection!!.getByUid(contact.uid) as LocalResource?
if (cEntry.isAction(SyncEntry.Actions.ADD) || cEntry.isAction(SyncEntry.Actions.CHANGE)) { if (cEntry.isAction(SyncEntry.Actions.ADD) || cEntry.isAction(SyncEntry.Actions.CHANGE)) {

View File

@ -180,7 +180,7 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
} }
} }
override fun onCreateLoader(id: Int, args: Bundle): Loader<AccountInfo> { override fun onCreateLoader(id: Int, args: Bundle?): Loader<AccountInfo> {
return AccountLoader(this, account!!) return AccountLoader(this, account!!)
} }

View File

@ -60,7 +60,7 @@ class AppSettingsActivity : BaseActivity() {
dbHelper.close() dbHelper.close()
} }
override fun onCreatePreferences(bundle: Bundle, s: String) { override fun onCreatePreferences(bundle: Bundle?, s: String?) {
addPreferencesFromResource(R.xml.settings_app) addPreferencesFromResource(R.xml.settings_app)
prefResetHints = findPreference("reset_hints") prefResetHints = findPreference("reset_hints")

View File

@ -72,7 +72,7 @@ class DebugInfoActivity : BaseActivity(), LoaderManager.LoaderCallbacks<String>
ACRA.getErrorReporter().removeCustomData("debug_info") ACRA.getErrorReporter().removeCustomData("debug_info")
} }
override fun onCreateLoader(id: Int, args: Bundle): Loader<String> { override fun onCreateLoader(id: Int, args: Bundle?): Loader<String> {
return ReportLoader(this, args) return ReportLoader(this, args)
} }
@ -101,7 +101,7 @@ class DebugInfoActivity : BaseActivity(), LoaderManager.LoaderCallbacks<String>
var phase: String? = null var phase: String? = null
if (extras != null) { if (extras != null) {
throwable = extras.getSerializable(KEY_THROWABLE) as Throwable throwable = extras.getSerializable(KEY_THROWABLE) as Throwable?
logs = extras.getString(KEY_LOGS) logs = extras.getString(KEY_LOGS)
account = extras.getParcelable(KEY_ACCOUNT) account = extras.getParcelable(KEY_ACCOUNT)
authority = extras.getString(KEY_AUTHORITY) authority = extras.getString(KEY_AUTHORITY)