[epiphany] ephy-history-service-urls-table: do not g_assert on input



commit 2bcc70a27132a5959dac7d03531ebaf3435f4e5e
Author: Xan Lopez <xan igalia com>
Date:   Wed Mar 7 15:56:23 2012 +0100

    ephy-history-service-urls-table: do not g_assert on input
    
    Simply bail out and don't crash the browser.

 lib/history/ephy-history-service-urls-table.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index 75d98ea..7b95c03 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -61,10 +61,10 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
   g_assert (priv->history_thread == g_thread_self ());
   g_assert (priv->history_database != NULL);
 
-  if (url_string == NULL && url != NULL) {
+  if (url_string == NULL && url != NULL)
     url_string = url->url;
-  }
-  g_assert (url_string || url->id != -1);
+
+  g_return_val_if_fail (url_string || url->id != -1, NULL);
 
   if (url != NULL && url->id != -1) {
     statement = ephy_sqlite_connection_create_statement (priv->history_database,
@@ -364,7 +364,7 @@ ephy_history_service_delete_url (EphyHistoryService *self, EphyHistoryURL *url)
   g_assert (priv->history_thread == g_thread_self ());
   g_assert (priv->history_database != NULL);
 
-  g_assert (url->id != -1 || url->url);
+  g_return_if_fail (url->id != -1 || url->url);
 
   if (url->id != -1)
     sql_statement = g_strdup ("DELETE FROM urls WHERE id=?");



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