Avoid a potential crash

This commit is contained in:
Pierre Pronchery 2012-09-10 22:14:29 +00:00
parent e5efc6422d
commit eb84910662

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2009-2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Todo */ /* This file is part of DeforaOS Desktop Todo */
/* This program is free software: you can redistribute it and/or modify /* 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 * it under the terms of the GNU General Public License as published by
@ -24,7 +24,6 @@
#include "../config.h" #include "../config.h"
#define _(string) gettext(string) #define _(string) gettext(string)
/* constants */ /* constants */
#ifndef PREFIX #ifndef PREFIX
# define PREFIX "/usr/local" # define PREFIX "/usr/local"
@ -37,6 +36,8 @@
#endif #endif
/* private */
/* functions */
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
@ -45,6 +46,8 @@ static int _usage(void)
} }
/* public */
/* functions */
/* main */ /* main */
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
@ -63,7 +66,8 @@ int main(int argc, char * argv[])
} }
if(optind != argc) if(optind != argc)
return _usage(); return _usage();
todo = todo_new(); if((todo = todo_new()) == NULL)
return 2;
gtk_main(); gtk_main();
todo_delete(todo); todo_delete(todo);
return 0; return 0;