Gracefully handle unset history and search engines
So app mode actually fails to search reliably and not by accident.
This commit is contained in:
parent
150082a6df
commit
fc8d0a1179
2 changed files with 24 additions and 22 deletions
|
@ -383,6 +383,8 @@ katze_array_find_token (KatzeArray* array,
|
|||
guint i;
|
||||
gpointer item;
|
||||
|
||||
g_return_val_if_fail (KATZE_IS_ARRAY (array), NULL);
|
||||
|
||||
i = 0;
|
||||
while ((item = g_list_nth_data (array->items, i++)))
|
||||
{
|
||||
|
|
|
@ -3511,14 +3511,10 @@ _action_location_submit_uri (GtkAction* action,
|
|||
gchar** parts;
|
||||
gchar* keywords = NULL;
|
||||
const gchar* search_uri = NULL;
|
||||
time_t now;
|
||||
gint64 day;
|
||||
sqlite3* db;
|
||||
static sqlite3_stmt* statement = NULL;
|
||||
|
||||
/* Do we have a keyword and a string? */
|
||||
parts = g_strsplit (stripped_uri, " ", 2);
|
||||
if (parts[0])
|
||||
if (parts[0] && browser->search_engines)
|
||||
{
|
||||
KatzeItem* item;
|
||||
if ((item = katze_array_find_token (browser->search_engines, parts[0])))
|
||||
|
@ -3538,10 +3534,13 @@ _action_location_submit_uri (GtkAction* action,
|
|||
}
|
||||
new_uri = sokoke_search_uri (search_uri, keywords);
|
||||
|
||||
now = time (NULL);
|
||||
day = sokoke_time_t_to_julian (&now);
|
||||
if (browser->history != NULL)
|
||||
{
|
||||
time_t now = time (NULL);
|
||||
gint64 day = sokoke_time_t_to_julian (&now);
|
||||
sqlite3* db = g_object_get_data (G_OBJECT (browser->history), "db");
|
||||
static sqlite3_stmt* statement = NULL;
|
||||
|
||||
db = g_object_get_data (G_OBJECT (browser->history), "db");
|
||||
if (!statement)
|
||||
{
|
||||
const gchar* sqlcmd;
|
||||
|
@ -3558,6 +3557,7 @@ _action_location_submit_uri (GtkAction* action,
|
|||
sqlite3_reset (statement);
|
||||
if (sqlite3_step (statement) == SQLITE_DONE)
|
||||
sqlite3_clear_bindings (statement);
|
||||
}
|
||||
|
||||
g_free (keywords);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue