Some fixes

This commit is contained in:
tom79 2019-08-16 17:35:18 +02:00
parent 591bfa567a
commit 0c11d999f9
4 changed files with 13 additions and 5 deletions

View File

@ -45,7 +45,7 @@ public class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
/* if (BuildConfig.DEBUG) {
/* if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()

View File

@ -357,8 +357,10 @@ public class AccountDAO {
*/
private List<Account> cursorToListUser(Cursor c){
//No element found
if (c.getCount() == 0)
if (c.getCount() == 0) {
c.close();
return null;
}
List<Account> accounts = new ArrayList<>();
while (c.moveToNext() ) {
//New user

View File

@ -133,8 +133,10 @@ public class TempMuteDAO {
*/
private List<String> cursorToTimeMute(Cursor c){
//No element found
if (c.getCount() == 0)
if (c.getCount() == 0) {
c.close();
return null;
}
List<String> timeMutes = new ArrayList<>();
while (c.moveToNext() ) {
timeMutes.add(c.getString(c.getColumnIndex(Sqlite.COL_TARGETED_USER_ID)));

View File

@ -164,8 +164,10 @@ public class TimelineCacheDAO {
*/
private Status cursorToSingleStatus(Cursor c){
//No element found
if (c.getCount() == 0)
if (c.getCount() == 0) {
c.close();
return null;
}
c.moveToFirst();
Status status = null;
try {
@ -187,8 +189,10 @@ public class TimelineCacheDAO {
*/
private List<Status> cursorToListStatus(Cursor c){
//No element found
if (c.getCount() == 0)
if (c.getCount() == 0) {
c.close();
return null;
}
List<Status> statuses = new ArrayList<>();
while (c.moveToNext() ) {
//Restore cached status