Fix cursor is empty in ApnEditor

If cursor.moveToFirst() returns false, the cursor is empty which cause
crash.

Check whether the curse is empty to fix.

Fix: 288716180
Test: manual - on ApnEditor page
Test: m RunSettingsRoboTests
Change-Id: If850cd3feca3d3d520a653c2490d1049a8a87fdc
This commit is contained in:
Chaohui Wang
2023-06-28 19:13:42 +08:00
parent a09fd45249
commit b17ef6f91e
2 changed files with 19 additions and 2 deletions

View File

@@ -1440,8 +1440,7 @@ public class ApnEditor extends SettingsPreferenceFragment
null /* selection */,
null /* selectionArgs */,
null /* sortOrder */)) {
if (cursor != null) {
cursor.moveToFirst();
if (cursor != null && cursor.moveToFirst()) {
apnData = new ApnData(uri, cursor);
}
}