Browse Source

Use the existing diagnostic macros for desktop PM errors

master
evgeny 1 week ago
parent
commit
934f1ccd1f
  1. 6
      tools/chatgui/src/messagelist.cpp

6
tools/chatgui/src/messagelist.cpp

@ -505,11 +505,11 @@ MessageList::MessageList(DbManager* db, AudioRecorder* recorder, QWidget *parent
if (m_currentChannelId.isEmpty()) return;
if (isDmChannel(m_currentChannelId)) {
auto* req = (struct dm_file_req*)u_calloc(1, sizeof(struct dm_file_req));
if (!req) { GUI_ERROR("PM file request allocation failed"); return; }
if (!req) { DEBUG_ERROR(DEBUG_CATEGORY_DM, "PM file request allocation failed"); return; }
req->inst = gui_bridge_get_inst();
QByteArray conv = dmConvId(m_currentChannelId).toUtf8(), path = mediaSrc.toUtf8(), name = displayName.toUtf8();
if (path.size() >= (int)sizeof(req->path) || name.size() >= (int)sizeof(req->name)) {
GUI_ERROR("PM attachment path or name is too long"); u_free(req); return;
DEBUG_ERROR(DEBUG_CATEGORY_DM, "PM attachment path or name is too long"); u_free(req); return;
}
snprintf(req->conv, sizeof(req->conv), "%s", conv.constData());
snprintf(req->path, sizeof(req->path), "%s", path.constData());
@ -1094,7 +1094,7 @@ void MessageList::onDmMessages(const uint8_t* data, int len) {
QJsonParseError error;
auto document = QJsonDocument::fromJson(QByteArray((const char*)data + 1 + cl, len - 1 - cl), &error);
if (error.error != QJsonParseError::NoError || !document.isArray()) {
GUI_ERROR("Invalid PM history JSON: %s", qPrintable(error.errorString())); return;
DEBUG_ERROR(DEBUG_CATEGORY_DM, "Invalid PM history JSON: %s", qPrintable(error.errorString())); return;
}
auto* scrollbar = m_view->verticalScrollBar();
bool atBottom = m_model->rowCount() == 0 || scrollbar->value() >= scrollbar->maximum();

Loading…
Cancel
Save