diff options
| author | Martin Owens <doctormo@gmail.com> | 2014-01-22 23:06:39 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2014-01-22 23:06:39 +0000 |
| commit | ae7f7f7449a2da248ff13119e802a104de297c3d (patch) | |
| tree | 8d880416445f339cfc6329c4a224883d44ecbd72 /src | |
| parent | Move sub-document reference creation code from uri-reference to document.cpp ... (diff) | |
| download | inkscape-ae7f7f7449a2da248ff13119e802a104de297c3d.tar.gz inkscape-ae7f7f7449a2da248ff13119e802a104de297c3d.zip | |
Improve warnings for missing files. Don't just assert bolocks to the user.
(bzr r12972)
Diffstat (limited to 'src')
| -rw-r--r-- | src/uri-references.cpp | 5 | ||||
| -rw-r--r-- | src/xml/repr-io.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/uri-references.cpp b/src/uri-references.cpp index 1684c6ade..f2df55213 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -61,7 +61,10 @@ void URIReference::attach(const URI &uri) throw(BadURIException) if(path && document != NULL) { document = document->createChildDoc(path); } - g_return_if_fail(document != NULL); + if(!document) { + g_warning("Can't get document for referenced URI: %s", uri.toString()); + return; + } gchar const *fragment = uri.getFragment(); if ( !uri.isRelative() || uri.getQuery() || !fragment ) { diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 54eff00bc..0319bb5e3 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -334,7 +334,10 @@ Document *sp_repr_read_file (const gchar * filename, const gchar *default_ns) xmlSubstituteEntitiesDefault(1); g_return_val_if_fail (filename != NULL, NULL); - g_return_val_if_fail (Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS ), NULL); + if (!Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS )) { + g_warning("Can't open file: %s (doesn't exist)", filename); + return NULL; + } /* fixme: A file can disappear at any time, including between now and when we actually try to * open it. Get rid of the above test once we're sure that we correctly handle * non-existence. */ |
