[epiphany/history-rewrite: 13/45] ephy_history_service_get_url_row: avoid a segmentation fault



commit 95d69a2f839672b4244ae6b0471a77dd3ee04863
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon Jul 4 18:27:40 2011 +0300

    ephy_history_service_get_url_row: avoid a segmentation fault
    
    The url argument is allowed to be NULL, so guard against that

 lib/history/ephy-history-service-urls-table.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index 814dbe5..f4d7bc7 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -64,7 +64,7 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
   }
   g_assert (url_string || url->id != -1);
 
-  if (url->id != -1) {
+  if (url != NULL && url->id != -1) {
     statement = ephy_sqlite_connection_create_statement (priv->history_database,
       "SELECT id, url, title, visit_count, typed_count, last_visit_time FROM urls "
       "WHERE id=?", &error);
@@ -80,7 +80,7 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
     return NULL;
   }
 
-  if (url->id != -1) {
+  if (url != NULL && url->id != -1) {
     ephy_sqlite_statement_bind_int (statement, 0, url->id, &error);
   } else {
     ephy_sqlite_statement_bind_string (statement, 0, url_string, &error);



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