android: Avoid lint errors when determining column indices
authorTobias Brunner <tobias@strongswan.org>
Wed, 5 May 2021 14:09:37 +0000 (16:09 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 5 May 2021 14:40:14 +0000 (16:40 +0200)
commit6405653da2dd6360e5013dc64aaa0ca52fce1de5
treefc2b1a7dcb6d5602a6e87e7219e8c1429d6e6e46
parentf0a20dd2b879b8323b6690fe4d0679c1adc889a0
android: Avoid lint errors when determining column indices

The lint version used on our GitHub build hosts reported these errors:

Error: Value must be ≥ 0 [Range]
        db.update(TABLE_VPNPROFILE, values, KEY_ID + " = " + cursor.getLong(cursor.getColumnIndex(KEY_ID)), null);

That's because get*() expect a valid index >= 0 but getColumnIndex()
can return -1 if the column name doesn't exist.
src/frontends/android/app/src/main/java/org/strongswan/android/data/VpnProfileDataSource.java