Skip to content

Commit

Permalink
Fix handling of XML without root
Browse files Browse the repository at this point in the history
  • Loading branch information
svgpp committed Sep 30, 2022
1 parent 15da189 commit 0bc57f2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/demo/render/svgpp_render.cpp
Expand Up @@ -1656,7 +1656,10 @@ void renderDocument(XMLDocument & xmlDocument, ImageBuffer & buffer)
{
Document document(xmlDocument);
Canvas canvas(document, buffer);
document_traversal_main::load_document(xmlDocument.getRoot(), canvas);
if (XMLElement root = xmlDocument.getRoot())
document_traversal_main::load_document(root, canvas);
else
throw std::runtime_error("No root XML element");
}

int main(int argc, char * argv[])
Expand Down

0 comments on commit 0bc57f2

Please sign in to comment.