mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix a crash with profiles
This commit is contained in:
parent
7c5f1dccab
commit
bba6a2edf1
2 changed files with 21 additions and 3 deletions
|
@ -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 "
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue