Commit c78b9fed authored by Davis King's avatar Davis King

Fixed a bug in parse_xml(). It failed to check if the given input stream was

valid before trying to parse it.
parent ecdfdea6
......@@ -1412,6 +1412,8 @@ namespace dlib
error_handler& eh
)
{
if (!in)
throw xml_parse_error("Unexpected end of file during xml parsing.");
xml_parser parser;
parser.add_document_handler(dh);
parser.add_error_handler(eh);
......@@ -1424,6 +1426,8 @@ namespace dlib
document_handler& dh
)
{
if (!in)
throw xml_parse_error("Unexpected end of file during xml parsing.");
xml_parser parser;
parser.add_document_handler(dh);
parser.add_error_handler(eh);
......@@ -1435,6 +1439,8 @@ namespace dlib
error_handler& eh
)
{
if (!in)
throw xml_parse_error("Unexpected end of file during xml parsing.");
xml_parser parser;
parser.add_error_handler(eh);
parser.parse(in);
......@@ -1445,6 +1451,8 @@ namespace dlib
document_handler& dh
)
{
if (!in)
throw xml_parse_error("Unexpected end of file during xml parsing.");
xml_parser parser;
parser.add_document_handler(dh);
impl::default_xml_error_handler eh;
......
......@@ -223,7 +223,7 @@ namespace dlib
supplied error_handler and document_handler.
throws
- xml_parse_error
Thrown if there is a problem opening the input file.
Thrown if there is a problem parsing the input file.
!*/
void parse_xml (
......@@ -237,7 +237,7 @@ namespace dlib
supplied error_handler and document_handler.
throws
- xml_parse_error
Thrown if there is a problem opening the input file.
Thrown if there is a problem parsing the input file.
!*/
void parse_xml (
......@@ -250,7 +250,7 @@ namespace dlib
supplied error_handler.
throws
- xml_parse_error
Thrown if there is a problem opening the input file.
Thrown if there is a problem parsing the input file.
!*/
void parse_xml (
......@@ -265,8 +265,7 @@ namespace dlib
if a fatal parsing error is encountered.
throws
- xml_parse_error
Thrown if a fatal parsing error is encountered or if there is a problem
opening the input file.
Thrown if there is a problem parsing the input file.
!*/
// ----------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment