fix: author overwrite when converting from pwf (ref #409)

This commit is contained in:
jeefo 2023-03-13 15:20:13 +03:00
commit 290681d2d8
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED

View file

@ -1565,25 +1565,33 @@ bool BotGraph::convertOldFormat () {
// add to node array // add to node array
m_paths.push (cr::move (path)); m_paths.push (cr::move (path));
} }
}
}
else {
return false;
}
fp.close(); fp.close();
}
else {
return false;
}
// save new format in case loaded older one // save new format in case loaded older one
if (!m_paths.empty()) { if (!m_paths.empty()) {
ctrl.msg("Converting old PWF to new format Graph."); ctrl.msg("Converting old PWF to new format Graph.");
m_graphAuthor = header.author; m_graphAuthor = header.author;
return saveGraphData ();
// clean editor so graph will be saved with header's author
auto editor = m_editor;
m_editor = nullptr;
auto result = saveGraphData();
m_editor = editor;
return result;
} }
return true; }
}
else {
return false;
}
}
else {
return false;
}
return false;
} }
template <typename U> bool BotGraph::saveStorage (StringRef ext, StringRef name, StorageOption options, StorageVersion version, const SmallArray <U> &data, ExtenHeader *exten) { template <typename U> bool BotGraph::saveStorage (StringRef ext, StringRef name, StorageOption options, StorageVersion version, const SmallArray <U> &data, ExtenHeader *exten) {