[PATCH 2/2] Fail more gracefully in bookmark functions if we get passed a null.



The new (at least) man parsing code obviously has a bug where it's not
setting a page_id that it should. But this shouldn't cause a segfault!
---
 src/yelp-application.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/yelp-application.c b/src/yelp-application.c
index 0921d16..cae00dd 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -674,6 +674,9 @@ yelp_application_remove_bookmark (YelpBookmarks     *bookmarks,
     GSettings *settings;
     YelpApplication *app = YELP_APPLICATION (bookmarks);
 
+    g_return_if_fail (page_id);
+    g_return_if_fail (doc_uri);
+
     settings = application_get_doc_settings (app, doc_uri);
 
     if (settings) {
@@ -704,6 +707,9 @@ yelp_application_is_bookmarked (YelpBookmarks     *bookmarks,
     GSettings *settings;
     YelpApplication *app = YELP_APPLICATION (bookmarks);
 
+    g_return_if_fail (page_id);
+    g_return_if_fail (doc_uri);
+
     settings = application_get_doc_settings (app, doc_uri);
     if (settings == NULL)
         return FALSE;
@@ -731,6 +737,9 @@ yelp_application_update_bookmarks (YelpApplication   *app,
 {
     GSettings *settings;
 
+    g_return_if_fail (page_id);
+    g_return_if_fail (doc_uri);
+
     settings = application_get_doc_settings (app, doc_uri);
 
     if (settings) {
-- 
1.7.2.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]