From 37ace672b0645ea2c84e308788fe9c390041a40d Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 26 Apr 2009 21:57:07 +0200 Subject: few fixes related to NULL checking --- uzbl.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index b39eace..114079c 100644 --- a/uzbl.c +++ b/uzbl.c @@ -162,15 +162,17 @@ destroy_cb (GtkWidget* widget, gpointer data) { static void log_history_cb () { - time_t rawtime; - struct tm * timeinfo; - char date [80]; - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - strftime (date, 80, "%Y-%m-%d %H:%M:%S", timeinfo); - GString* args = g_string_new (""); - g_string_printf (args, "'%s' '%s' '%s'", uri, "TODO:page title here", date); - run_command(history_handler, args->str); + if (history_handler) { + time_t rawtime; + struct tm * timeinfo; + char date [80]; + time ( &rawtime ); + timeinfo = localtime ( &rawtime ); + strftime (date, 80, "%Y-%m-%d %H:%M:%S", timeinfo); + GString* args = g_string_new (""); + g_string_printf (args, "'%s' '%s' '%s'", uri, "TODO:page title here", date); + run_command(history_handler, args->str); + } } /* -- command to callback/function map for things we cannot attach to any signals */ @@ -215,11 +217,11 @@ run_command(const char *command, const char *args) { static void parse_command(const char *command) { int i; - Command *c; + Command *c = NULL; char * command_name = strtok (command, " "); char * command_param = strtok (NULL, " ,"); //dunno how this works, but it seems to work - Command *c_tmp; + Command *c_tmp = NULL; for (i = 0; i < LENGTH (commands); i++) { c_tmp = &commands[i]; if (strncmp (command_name, c_tmp->command, strlen (c_tmp->command)) == 0) { -- cgit v1.2.3