fixed json guessing
This commit is contained in:
parent
6bc7b9796b
commit
03d56b3054
@ -441,7 +441,7 @@ QVariant MessagesModel::data(const QModelIndex& idx, int role) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QFontMetrics fm(data(idx, Qt::ItemDataRole::FontRole).value<QFont>());
|
QFontMetrics fm(data(idx, Qt::ItemDataRole::FontRole).value<QFont>());
|
||||||
auto rct = fm.boundingRect(QRect(QPoint(0, 0), QPoint(wd - 10, 100000)),
|
auto rct = fm.boundingRect(QRect(QPoint(0, 0), QPoint(wd - 5, 100000)),
|
||||||
Qt::TextFlag::TextWordWrap |
|
Qt::TextFlag::TextWordWrap |
|
||||||
Qt::AlignmentFlag::AlignLeft |
|
Qt::AlignmentFlag::AlignLeft |
|
||||||
Qt::AlignmentFlag::AlignVCenter,
|
Qt::AlignmentFlag::AlignVCenter,
|
||||||
|
@ -295,7 +295,12 @@ StandardFeed* StandardFeed::guessFeed(StandardFeed::SourceType source_type,
|
|||||||
feed->setEncoding(QSL(DEFAULT_FEED_ENCODING));
|
feed->setEncoding(QSL(DEFAULT_FEED_ENCODING));
|
||||||
feed->setType(Type::Json);
|
feed->setType(Type::Json);
|
||||||
|
|
||||||
QJsonDocument json = QJsonDocument::fromJson(feed_contents);
|
QJsonParseError json_err;
|
||||||
|
QJsonDocument json = QJsonDocument::fromJson(feed_contents, &json_err);
|
||||||
|
|
||||||
|
if (json.isNull() && !json_err.errorString().isEmpty()) {
|
||||||
|
throw ApplicationException(tr("JSON error '%1'").arg(json_err.errorString()));
|
||||||
|
}
|
||||||
|
|
||||||
feed->setTitle(json.object()[QSL("title")].toString());
|
feed->setTitle(json.object()[QSL("title")].toString());
|
||||||
feed->setDescription(json.object()[QSL("description")].toString());
|
feed->setDescription(json.object()[QSL("description")].toString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user