<commit_before>package com.orm;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;


public class Database {
    private SugarDb sugarDb;
    private SQLiteDatabase sqLiteDatabase;

    public Database(Context context){
        this.sugarDb  = new SugarDb(context);
    }


  public SQLiteDatabase openDB() {
    this.sqLiteDatabase = this.sugarDb.getWritableDatabase();

    return this.sqLiteDatabase;
  }

  public void closeDB() {
    if (this.sqLiteDatabase != null) {
      this.sqLiteDatabase.close();
      this.sqLiteDatabase = null;
    }
  }
}<commit_msg>Prevent crash when trying to open database<commit_after>package com.orm;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;


public class Database {
    private SugarDb sugarDb;
    private SQLiteDatabase sqLiteDatabase;

    public Database(Context context){
        this.sugarDb  = new SugarDb(context);
    }


    public SQLiteDatabase openDB() {
        if (this.sqLiteDatabase == null) {
            this.sqLiteDatabase = this.sugarDb.getWritableDatabase();
        }

        return this.sqLiteDatabase;
    }

    public void closeDB() {
        if (this.sqLiteDatabase != null) {
            this.sqLiteDatabase.close();
            this.sqLiteDatabase = null;
        }
    }
}
{'fraction_non_alphanumeric': 0.09222560975609756, 'fraction_numerical': 0.0, 'mean_word_length': 2.9077380952380953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6254315', 'n_tokens_mistral': 386, 'n_tokens_neox': 385, 'n_words': 83}