fix(chat): diagnose channel catalog failures with SQL status and shape
This commit is contained in:
1 parent
fb7846780b
commit
1c6d203754
1 file changed
+3
-1
@@ -192,7 +192,9 @@ int chat_core_init(struct UTUN_INSTANCE* inst, const char* db_path) {
|
||||
{
|
||||
int rc = sqlite3_get_table(cc->db, "SELECT channel_id,length(CAST(channel_id AS BLOB)) FROM channels ORDER BY created_at ASC",
|
||||
&channels, &rows, &columns, NULL);
|
||||
if (rc != SQLITE_OK || (rows && columns != 2)) goto fail;
|
||||
if (rc != SQLITE_OK || (rows && columns != 2)) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "chat init: catalog rc=%d rows=%d columns=%d: %s", rc, rows, columns, sqlite3_errmsg(cc->db)); goto fail;
|
||||
}
|
||||
for (int i = 0; i < rows; i++) {
|
||||
const char *ch = channels[(size_t)(i + 1) * columns], *bytes = channels[(size_t)(i + 1) * columns + 1];
|
||||
if (!chat_channel_id(ch) || !bytes || strlen(ch) != strtoul(bytes, NULL, 10)) {
|
||||
|
||||
Reference in new issue
Block a user