Commit 876d61fc authored by Agata Cacko's avatar Agata Cacko
Browse files

Don't assert on invalid 0-bytes palettes (no user strings)

Before this commit, Krita would assert when the palette stored in
.kra file was 0-bytes. While it is an incorrect situation,
Krita shouldn't crash/assert, but inform the user about it
and load the rest of the file.

Cherry-picked from fbc005b1, but without the new
user string.
parent 3acd2425
...@@ -516,11 +516,12 @@ void KisKraLoader::loadPalettes(KoStore *store, KisDocument *doc) ...@@ -516,11 +516,12 @@ void KisKraLoader::loadPalettes(KoStore *store, KisDocument *doc)
KoColorSet *newPalette = new KoColorSet(filename); KoColorSet *newPalette = new KoColorSet(filename);
store->open(m_d->imageName + PALETTE_PATH + filename); store->open(m_d->imageName + PALETTE_PATH + filename);
QByteArray data = store->read(store->size()); QByteArray data = store->read(store->size());
newPalette->fromByteArray(data); if (data.size() > 0) {
newPalette->setIsGlobal(false); newPalette->fromByteArray(data);
newPalette->setIsEditable(true); newPalette->setIsEditable(true);
store->close(); store->close();
list.append(newPalette); list.append(newPalette);
}
} }
doc->setPaletteList(list); doc->setPaletteList(list);
} }
......
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