From eb84910662c5f61940d3314c6bd5ad0d15df95b9 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Mon, 10 Sep 2012 22:14:29 +0000 Subject: [PATCH] Avoid a potential crash --- src/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 0178c31..1fa77da 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2010 Pierre Pronchery */ +/* Copyright (c) 2009-2012 Pierre Pronchery */ /* This file is part of DeforaOS Desktop Todo */ /* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,6 @@ #include "../config.h" #define _(string) gettext(string) - /* constants */ #ifndef PREFIX # define PREFIX "/usr/local" @@ -37,6 +36,8 @@ #endif +/* private */ +/* functions */ /* usage */ static int _usage(void) { @@ -45,6 +46,8 @@ static int _usage(void) } +/* public */ +/* functions */ /* main */ int main(int argc, char * argv[]) { @@ -63,7 +66,8 @@ int main(int argc, char * argv[]) } if(optind != argc) return _usage(); - todo = todo_new(); + if((todo = todo_new()) == NULL) + return 2; gtk_main(); todo_delete(todo); return 0;