Handle info.json homepage type mismatches

This commit is contained in:
Mm2PL 2023-02-14 11:55:55 +01:00
parent 8b37a297d4
commit 94ceee3c7e

View file

@ -51,8 +51,21 @@ struct PluginMeta {
}
explicit PluginMeta(const QJsonObject &obj)
: homepage(obj.value("homepage").toString(""))
{
auto homepageObj = obj.value("homepage");
if (homepageObj.isString())
{
this->homepage = homepageObj.toString();
}
else if (!homepageObj.isUndefined())
{
auto type = QString::fromStdString(
std::string(magic_enum::enum_name(homepageObj.type())));
this->errors.emplace_back(
QString(
"homepage is defined but is not a string (its type is %1)")
.arg(type));
}
auto nameObj = obj.value("name");
if (nameObj.isString())
{