sammycage / lunasvg

SVG rendering and manipulation library in C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blank files will not load

leonstyhre opened this issue · comments

In my application (https://es-de.org) there are sometimes dummy SVG files used that will render to a blank texture. There are multiple reasons for this, primarily that variable names are used for populating images in the system themes and as some systems don't have some images like a Nintendo Game Boy that has no external controller that would lead to warnings for missing files during theme processing unless a dummy SVG file was used.

This is the content of such a dummy file:

<?xml version="1.0" encoding="UTF-8"?>
<svg width="42" height="42" version="1.1" viewBox="0 0 42 42" xmlns="http://www.w3.org/2000/svg">
</svg>

That works correctly with NanoSVG and is rendered as a blank texture. However with LunaSVG the loadFromData() call with fail and return nullptr. Could you make the behavior the same as in NanoSVG so that such blank files are rendered as blank textures?
Btw, these files are also possible to open in Inkscape without warnings so I'm pretty sure that they are valid files.

Thanks for fixing this issue, I can confirm that it now works as expected!