Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51cf245d authored by Simon Wingrove's avatar Simon Wingrove
Browse files

Catch and log NetworkWatchlist database corruption

This appears rare, but better to catch and log than throw.

Bug: 374361309
Change-Id: I6dedd14bcd2266c18c0dc7e991d75da573554b66
Test: N/A
Flag: EXEMPT simple bug fix
parent c1794771
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabaseCorruptException;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Environment;
@@ -204,6 +205,11 @@ class WatchlistReportDbHelper extends SQLiteOpenHelper {
            return false;
        }
        final String clause = WhiteListReportContract.TIMESTAMP + "< " + untilTimestamp;
        try {
            return db.delete(WhiteListReportContract.TABLE, clause, null) != 0;
        } catch (SQLiteDatabaseCorruptException e) {
            Slog.e(TAG, "Error deleting records", e);
            return false;
        }
    }
}