utils: Assume that the top object in svg cursor metadata is an array

This adapts the svg cursor loading code to the recent metadata format
changes.
This commit is contained in:
Vlad Zahorodnii 2024-08-22 14:07:56 +03:00
parent 95611189d5
commit 5cff8cd2d1

View file

@ -74,13 +74,7 @@ std::optional<SvgCursorMetaData> SvgCursorMetaData::parse(const QString &filePat
}
QList<SvgCursorMetaDataEntry> entries;
if (document.isObject()) {
if (const auto entry = SvgCursorMetaDataEntry::parse(document.object())) {
entries.append(entry.value());
} else {
return std::nullopt;
}
} else if (document.isArray()) {
if (document.isArray()) {
const QJsonArray array = document.array();
for (int i = 0; i < array.size(); ++i) {
const QJsonValue element = array.at(i);