mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't ignore when we can't parse a file
We are quite inconsistent when it comes to reporting back errors. One case where this caused somewhat unexpected behavior was when the user would try to open a .csv file by passing it as command line argument. The file was silently ignored, but treated as if it had been opened successfully. Now we issue a somewhat reasonable error message. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
77664e7150
commit
d9be07670c
3 changed files with 27 additions and 21 deletions
11
parse-xml.c
11
parse-xml.c
|
@ -1745,7 +1745,7 @@ const char *preprocess_divelog_de(const char *buffer)
|
|||
return buffer;
|
||||
}
|
||||
|
||||
void parse_xml_buffer(const char *url, const char *buffer, int size,
|
||||
int parse_xml_buffer(const char *url, const char *buffer, int size,
|
||||
struct dive_table *table, const char **params)
|
||||
{
|
||||
xmlDoc *doc;
|
||||
|
@ -1756,10 +1756,9 @@ void parse_xml_buffer(const char *url, const char *buffer, int size,
|
|||
if (res != buffer)
|
||||
free((char *)res);
|
||||
|
||||
if (!doc) {
|
||||
report_error(translate("gettextFromC", "Failed to parse '%s'"), url);
|
||||
return;
|
||||
}
|
||||
if (!doc)
|
||||
return report_error(translate("gettextFromC", "Failed to parse '%s'"), url);
|
||||
|
||||
set_save_userid_local(false);
|
||||
set_userid("");
|
||||
reset_all();
|
||||
|
@ -1768,6 +1767,8 @@ void parse_xml_buffer(const char *url, const char *buffer, int size,
|
|||
traverse(xmlDocGetRootElement(doc));
|
||||
dive_end();
|
||||
xmlFreeDoc(doc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void parse_mkvi_buffer(struct membuffer *txt, struct membuffer *csv, const char *starttime)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue