svg: check if svg file object is valid to avoid crash