diff --git a/src/ssb.db.c b/src/ssb.db.c index 4d576bb3..ff7f50a1 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -1334,7 +1334,7 @@ static bool _remove_following_entry(following_t*** list, int* count, following_t { if (*count - index > 1) { - memmove(*list + index, *list + index + 1, sizeof(following_t*) * (*count - index)); + memmove(*list + index, *list + index + 1, sizeof(following_t*) * (*count - index - 1)); } *list = tf_resize_vec(*list, sizeof(**list) * (*count - 1)); (*count)--; @@ -1383,6 +1383,10 @@ static following_t* _get_following(tf_ssb_t* ssb, const char* id, following_t*** while (sqlite3_step(statement) == SQLITE_ROW) { const char* contact = (const char*)sqlite3_column_text(statement, 0); + if (!contact) + { + continue; + } if (sqlite3_column_type(statement, 1) != SQLITE_NULL) { bool is_following = sqlite3_column_int(statement, 1) != 0;