From a8897d886ac87d3dddcaa565a07959289df3d0bc Mon Sep 17 00:00:00 2001 From: eschnett Date: Sun, 20 Jan 2013 03:44:11 +0000 Subject: Add more error checks when activating thorns git-svn-id: http://svn.cactuscode.org/flesh/trunk@4945 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/main/ActiveThorns.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/ActiveThorns.c b/src/main/ActiveThorns.c index 7a4afccd..a7b0730c 100644 --- a/src/main/ActiveThorns.c +++ b/src/main/ActiveThorns.c @@ -960,18 +960,25 @@ int CCTKi_ActivateThorns(const char *activethornlist) thorn = Util_StringListNext(activated_thorns,0)) { this_thorn = ((t_sktree *) SKTreeFindNode(thornlist, thorn))->data; - if(this_thorn->activates_thorns) + if(this_thorn && this_thorn->activates_thorns) { for(i = 0; this_thorn->activates_thorns[i]; i++) { new_thorn = this_thorn->activates_thorns[i]; if (! CCTK_IsThornActive(new_thorn)) { - if (Util_StringListAdd(new_thorns, new_thorn)) + switch (Util_StringListAdd(new_thorns, new_thorn)) { + case 0: + /* Thorn already scheduled for activation */ + break; + case 1: printf("Thorn %s requests automatic activation of %s\n", thorn, new_thorn); did_add_thorns = 1; + break; + default: + CCTK_Warn(0, __LINE__, __FILE__, "Cactus", "Internal error"); } } } -- cgit v1.2.3