Commit fa0d3635 authored by Halla Rempt's avatar Halla Rempt
Browse files

Check the tag before putting it in the list

KisResourceLocator::tagForUrlNoCache can return KisTagSP(), so
we need to check everywhere whether the tag exists and is valid.

BUG:454052
parent 4e32d714
Pipeline #204316 failed with stage
in 48 minutes and 35 seconds
......@@ -906,6 +906,11 @@ void KisResourceLocator::saveTags()
KisTagSP tag = tagForUrlNoCache(query.value("tags.url").toString(),
query.value("resource_types.name").toString());
if (!tag || !tag->valid()) {
continue;
}
QString filename = tag->filename();
if (filename.isEmpty() || QFileInfo(filename).suffix().isEmpty()) {
filename = tag->url() + ".tag";
......
......@@ -577,7 +577,9 @@ QVector<KisTagSP> KisAllResourcesModel::tagsForResource(int resourceId) const
QVector<KisTagSP> tags;
while (q.next()) {
KisTagSP tag = KisResourceLocator::instance()->tagForUrl(q.value(0).toString(), d->resourceType);
tags << tag;
if (tag && tag->valid()) {
tags << tag;
}
}
return tags;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment