From af8c071b4a22dfc3d96cda236ed687cf2d974ccb Mon Sep 17 00:00:00 2001 From: likeazir Date: Sun, 17 Nov 2024 22:15:41 +0100 Subject: [PATCH] fix sql strings are indexed at 1 --- .../android/api/session/AccountSessionManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java index ea896dc3..45ea9136 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java @@ -384,7 +384,7 @@ public class AccountSessionManager{ private void readInstanceInfo(SQLiteDatabase db, Set domains){ for(String domain : domains){ final int maxEmojiLength=500000; - try(Cursor cursor=db.rawQuery("SELECT domain, instance_obj, substring(emojis,0,?) AS emojis, length(emojis) AS emoji_length, last_updated, version FROM instances WHERE `domain` = ?", + try(Cursor cursor=db.rawQuery("SELECT domain, instance_obj, substr(emojis,1,?) AS emojis, length(emojis) AS emoji_length, last_updated, version FROM instances WHERE `domain` = ?", new String[]{String.valueOf(maxEmojiLength) , domain})) { ContentValues values=new ContentValues(); while(cursor.moveToNext()){ @@ -401,7 +401,7 @@ public class AccountSessionManager{ int emojiStringLength=values.getAsInteger("emoji_length"); if(emojiStringLength>maxEmojiLength){ final int pagesize=1000000; - for(int start=maxEmojiLength; start