[gnome-documents/gnome-3-10] places-bookmarks: Don't crash if page has no text
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/gnome-3-10] places-bookmarks: Don't crash if page has no text
- Date: Tue, 7 Oct 2014 09:31:50 +0000 (UTC)
commit 52bbf01885b22a734ea387d327b03ff2bf46c9b3
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Oct 6 19:02:42 2014 +0200
places-bookmarks: Don't crash if page has no text
https://bugzilla.gnome.org/show_bug.cgi?id=738015
src/lib/gd-places-bookmarks.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/lib/gd-places-bookmarks.c b/src/lib/gd-places-bookmarks.c
index 1a513d1..6348e62 100644
--- a/src/lib/gd-places-bookmarks.c
+++ b/src/lib/gd-places-bookmarks.c
@@ -178,7 +178,7 @@ get_pretty_name (const char *text)
{
char *name = NULL;
char *trimmed;
- char *basename;
+ char *basename = NULL;
int i;
int last_word = -1;
int last_sentence = -1;
@@ -213,6 +213,11 @@ get_pretty_name (const char *text)
i = last_word;
}
+ if (i == -1) {
+ name = NULL;
+ goto out;
+ }
+
basename = g_utf8_substring (trimmed, 0, i);
if (ellipse) {
name = g_strdup_printf ("“%s…”", basename);
@@ -220,6 +225,7 @@ get_pretty_name (const char *text)
name = g_strdup_printf ("“%s”", basename);
}
+ out:
g_free (basename);
g_free (trimmed);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]