[gnome-documents] documents: be more robust to malformed input
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] documents: be more robust to malformed input
- Date: Tue, 5 Jun 2012 21:31:23 +0000 (UTC)
commit 20396d0ee8f9ae37840adf29cf2b86e3a0ce9ecf
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Jun 5 15:42:58 2012 -0400
documents: be more robust to malformed input
We can get any kind of results out of tracker, so we have to be very
careful not to pass NULL around where a string might be expected.
src/documents.js | 7 +++++--
src/lib/gd-utils.c | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 2b14d37..84a3433 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -343,11 +343,14 @@ const DocCommon = new Lang.Class({
this.uri = '';
let title = cursor.get_string(Query.QueryColumns.TITLE)[0];
+ let filename = cursor.get_string(Query.QueryColumns.FILENAME)[0];
+
if (title && title != '')
this.name = title;
+ else if (filename)
+ this.name = Gd.filename_strip_extension(filename);
else
- this.name = Gd.filename_strip_extension(
- cursor.get_string(Query.QueryColumns.FILENAME)[0]);
+ this.name = '';
this._sanitizeTitle();
diff --git a/src/lib/gd-utils.c b/src/lib/gd-utils.c
index 38c0075..164de3d 100644
--- a/src/lib/gd-utils.c
+++ b/src/lib/gd-utils.c
@@ -277,7 +277,7 @@ gd_filename_get_extension_offset (const char *filename)
/**
* gd_filename_strip_extension:
- * @filename_with_extension:
+ * @filename_with_extension: (allow-none):
*
* Returns: (transfer full):
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]