Fixed mindgen crashing on nodes without ID. Removed ghost print

This commit is contained in:
nedko 2023-05-22 19:45:55 +03:00
parent 9c239c6bb2
commit 971e3099ff
2 changed files with 7 additions and 6 deletions

View File

@ -7,7 +7,7 @@
using namespace std; using namespace std;
void printTree(MindNode* root) void printTree(MindNode* root)
{/* {
if (root != NULL) if (root != NULL)
{ {
cout << "ID: " << root->getID() << endl; cout << "ID: " << root->getID() << endl;
@ -25,7 +25,7 @@ void printTree(MindNode* root)
cout << "RIGHT" << endl; cout << "RIGHT" << endl;
printTree(root->getNextNode()); printTree(root->getNextNode());
} }
cout << "UP" << endl;*/ cout << "UP" << endl;
} }
int main(int argc, char** argv) int main(int argc, char** argv)
@ -48,7 +48,7 @@ int main(int argc, char** argv)
return -1; return -1;
} }
printTree(root); // printTree(root);
write_html(output_file, root); write_html(output_file, root);
delete root; delete root;

View File

@ -242,7 +242,6 @@ parse_mindmap(istream& in, MindNode** root)
generate_map(content, current_tag); generate_map(content, current_tag);
// Map parse // Map parse
if ("map" == current_tag.name) if ("map" == current_tag.name)
{ {
if (NULL != current_node) if (NULL != current_node)
@ -262,7 +261,10 @@ parse_mindmap(istream& in, MindNode** root)
{ {
MindNode* node_new = new MindNode(); MindNode* node_new = new MindNode();
if (current_tag.params.end() != current_tag.params.find("ID"))
{
node_new->setID(current_tag.params.find("ID")->second); node_new->setID(current_tag.params.find("ID")->second);
}
if (current_tag.params.end() != current_tag.params.find("TEXT")) if (current_tag.params.end() != current_tag.params.find("TEXT"))
{ {
@ -313,7 +315,6 @@ parse_mindmap(istream& in, MindNode** root)
} }
} }
} }
cout << endl;
return 0; return 0;
} }