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
m_paths.push (cr::move (path));
}
fp.close();
// save new format in case loaded older one
if (!m_paths.empty()) {
ctrl.msg("Converting old PWF to new format Graph.");
m_graphAuthor = header.author;
// 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;
}
}
}
else {
return false;
}
fp.close ();
}
else {
return false;
}
// save new format in case loaded older one
if (!m_paths.empty ()) {
ctrl.msg ("Converting old PWF to new format Graph.");
m_graphAuthor = header.author;
return saveGraphData ();
}
return true;
return false;
}
template <typename U> bool BotGraph::saveStorage (StringRef ext, StringRef name, StorageOption options, StorageVersion version, const SmallArray <U> &data, ExtenHeader *exten) {