mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Close cursor in retrieveConfigLastUpdateTimestamp (#1692)
This commit is contained in:
parent
ed1bddd10b
commit
ecfa5d346a
@ -44,10 +44,14 @@ class ConfigDatabase(context: Context, helper: SQLCipherOpenHelper): Database(co
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun retrieveConfigLastUpdateTimestamp(variant: String, publicKey: String): Long {
|
fun retrieveConfigLastUpdateTimestamp(variant: String, publicKey: String): Long {
|
||||||
val db = readableDatabase
|
return readableDatabase
|
||||||
val cursor = db.query(TABLE_NAME, arrayOf(TIMESTAMP), VARIANT_AND_PUBKEY_WHERE, arrayOf(variant, publicKey),null, null, null)
|
.query(TABLE_NAME, arrayOf(TIMESTAMP), VARIANT_AND_PUBKEY_WHERE, arrayOf(variant, publicKey), null, null, null)
|
||||||
if (cursor == null) return 0
|
?.use { cursor ->
|
||||||
if (!cursor.moveToFirst()) return 0
|
if (cursor.moveToFirst()) {
|
||||||
return (cursor.getLongOrNull(cursor.getColumnIndex(TIMESTAMP)) ?: 0)
|
cursor.getLongOrNull(cursor.getColumnIndex(TIMESTAMP))
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} ?: 0L
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user