No data is not an error

This commit is contained in:
Eism 2022-04-26 11:19:27 +03:00 committed by Elnur Ismailzada
parent f5fa5b811a
commit 683fe9657d
3 changed files with 1 additions and 7 deletions

View file

@ -86,7 +86,7 @@ void PaletteWorkspaceSetup::setup()
auto loadData = [this]() {
RetVal<QByteArray> data = workspacesDataProvider()->rawData(DataKey::Palettes);
PaletteTreePtr tree;
if (data.ret) {
if (data.ret && !data.val.isEmpty()) {
LOGD() << "there is palette data in the workspace, we will use it";
ByteArray ba = ByteArray::fromQByteArrayNoCopy(data.val);
tree = readPalette(ba);

View file

@ -71,11 +71,6 @@ RetVal<QByteArray> Workspace::rawData(const DataKey& key) const
return RetVal<QByteArray>(make_ret(Err::NotLoaded));
}
QByteArray data = m_file.data(key_to_string(key));
if (data.isEmpty()) {
return RetVal<QByteArray>(make_ret(Err::NoData));
}
RetVal<QByteArray> rv;
rv.ret = make_ret(Ret::Code::Ok);
rv.val = m_file.data(key_to_string(key));

View file

@ -31,7 +31,6 @@ enum class Err {
UnknownError = int(Ret::Code::WorkspaceFirst),
NotLoaded = 1502,
NoData = 1503,
FailedPack = 1510,
FailedUnPack = 1511,