From b85cfb5c5c896217c19efbd161886ce5b52ec090 Mon Sep 17 00:00:00 2001 From: alegrand Date: Thu, 25 Aug 2005 22:14:38 +0000 Subject: [PATCH] Catch not_found_error. I'm just restoring the previous semantic... We have to decide whether this should be done here or by people calling this function... The nice point with letting others do it is that it enables to store NULL pointers in a dict. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1663 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/xbt/dict.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 37bc17511d..1327951c25 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -128,9 +128,18 @@ xbt_dict_get_ext(xbt_dict_t dict, void * xbt_dict_get(xbt_dict_t dict, const char *key) { + xbt_ex_t e; xbt_assert(dict); - return xbt_dictelm_get(dict->head, key); + TRY { + return xbt_dictelm_get(dict->head, key); + } CATCH(e) { + if(e.category==not_found_error) { + return NULL; + } + RETHROW; + } + return NULL; } /** -- 2.20.1