diff options
author | Frederic Culot <calcurse@culot.org> | 2009-01-24 20:41:52 +0000 |
---|---|---|
committer | Frederic Culot <calcurse@culot.org> | 2009-01-24 20:41:52 +0000 |
commit | 9549ee0f8c1635fb5bd414ec03c36e8439411a03 (patch) | |
tree | 07b574bc50068c6469a09cd7072e27d4c66ad87a | |
parent | 197a914c51ab6a0d18e8cfed6977584e318fbd5e (diff) | |
download | calcurse-9549ee0f8c1635fb5bd414ec03c36e8439411a03.tar.gz calcurse-9549ee0f8c1635fb5bd414ec03c36e8439411a03.zip |
do not crash when canceling the thread if it was not launched before
-rwxr-xr-x | src/calendar.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/calendar.c b/src/calendar.c index 12551ab..6728a84 100755 --- a/src/calendar.c +++ b/src/calendar.c @@ -1,8 +1,8 @@ -/* $calcurse: calendar.c,v 1.21 2008/12/28 13:13:59 culot Exp $ */ +/* $calcurse: calendar.c,v 1.22 2009/01/24 20:41:52 culot Exp $ */ /* * Calcurse - text-based organizer - * Copyright (c) 2004-2008 Frederic Culot + * Copyright (c) 2004-2009 Frederic Culot * * 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 @@ -86,15 +86,14 @@ void calendar_start_date_thread (void) { pthread_create (&calendar_t_date, NULL, calendar_date_thread, NULL); - return; } /* Stop the calendar date thread. */ void calendar_stop_date_thread (void) { - pthread_cancel (calendar_t_date); - return; + if (calendar_t_date) + pthread_cancel (calendar_t_date); } /* Set static variable today to current date */ |