Commit bba6a2ed authored by Thomas's avatar Thomas
Browse files

Fix a crash with profiles

parent 7c5f1dcc
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -14,8 +14,12 @@ package app.fedilab.android.mastodon.client.entities.app;
 * You should have received a copy of the GNU General Public License along with Fedilab; if not,
 * see <http://www.gnu.org/licenses>. */

import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;

import android.content.ContentValues;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
@@ -24,6 +28,8 @@ import android.os.Looper;
import android.os.Parcel;
import android.util.Base64;

import androidx.preference.PreferenceManager;

import com.google.gson.annotations.SerializedName;

import java.io.BufferedOutputStream;
@@ -35,6 +41,7 @@ import java.util.Date;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

import app.fedilab.android.MainApplication;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.exception.DBException;
@@ -206,9 +213,15 @@ public class CachedBundle {
        if (db == null) {
            throw new DBException("db is null. Wrong initialization.");
        }
        if (account == null || target_id == null) {
        if (target_id == null) {
            return null;
        }
        if (account == null) {
            account = new BaseAccount();
            SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
            account.user_id = sharedpreferences.getString(PREF_USER_ID, null);
            account.instance = sharedpreferences.getString(PREF_USER_INSTANCE, null);
        }
        try {
            Cursor c = db.query(Sqlite.TABLE_INTENT, null, Sqlite.COL_USER_ID + " = '" + account.user_id + "' AND "
                    + Sqlite.COL_INSTANCE + " = '" + account.instance + "' AND "
@@ -235,9 +248,15 @@ public class CachedBundle {
        if (db == null) {
            throw new DBException("db is null. Wrong initialization.");
        }
        if (account == null || target_id == null) {
        if (target_id == null) {
            return null;
        }
        if (account == null) {
            account = new BaseAccount();
            SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
            account.user_id = sharedpreferences.getString(PREF_USER_ID, null);
            account.instance = sharedpreferences.getString(PREF_USER_INSTANCE, null);
        }
        try {
            Cursor c = db.query(Sqlite.TABLE_INTENT, null, Sqlite.COL_USER_ID + " = '" + account.user_id + "' AND "
                    + Sqlite.COL_INSTANCE + " = '" + account.instance + "' AND "
+0 −1
Original line number Diff line number Diff line
@@ -375,7 +375,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
            binding.swipeContainer.setRefreshing(false);
            binding.swipeContainer.setEnabled(false);
        }

        if (arguments != null) {
            long bundleId = arguments.getLong(Helper.ARG_INTENT_ID, -1);
            if (bundleId != -1) {