aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
authorGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-04-26 21:57:07 +0200
committerGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-04-26 21:57:07 +0200
commit37ace672b0645ea2c84e308788fe9c390041a40d (patch)
tree0351c692dff252ab30d4a973c91539efc66a147a /uzbl.c
parent4a659355da2fa5ed61127ba82e0b219b002d7f6d (diff)
few fixes related to NULL checking
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c24
1 files changed, 13 insertions, 11 deletions
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) {