Commit 66c4670e authored by Halla Rempt's avatar Halla Rempt
Browse files

Don't crash on PSD files saved by Creative Cloud that have lots of groups

parent ab76c3ae
......@@ -194,7 +194,7 @@ KisImageBuilder_Result PSDLoader::decode(const KUrl& uri)
if (!psdread(&buffer, &type)) {
return KisImageBuilder_RESULT_FAILURE;
}
if (type == BOUNDING_DIVIDER) {
if (type == BOUNDING_DIVIDER && !groupStack.isEmpty()) {
KisGroupLayerSP groupLayer = new KisGroupLayer(m_image, "temp", OPACITY_OPAQUE_U8);
m_image->addNode(groupLayer, groupStack.top());
groupStack.push(groupLayer);
......@@ -210,8 +210,14 @@ KisImageBuilder_Result PSDLoader::decode(const KUrl& uri)
dbgFile << "failed reading channels for layer: " << layerRecord->layerName << layerRecord->error;
return KisImageBuilder_RESULT_FAILURE;
}
if (!groupStack.isEmpty()) {
m_image->addNode(layer, groupStack.top());
}
else {
m_image->addNode(layer, m_image->root());
}
layer->setVisible(layerRecord->visible);
}
}
}
......
Markdown is supported
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