From 44f7a88fd6ee58d9d167090423eab42b0c2fe91c Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 5 Sep 2007 19:23:37 +0000 Subject: [PATCH] * libltdl/ltdl.c (lt_dlcaller_get_data): Work even when no caller has set data. --- ChangeLog | 5 +++++ libltdl/ltdl.c | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 850636905..293dbf339 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-09-05 Eric Blake + + * libltdl/ltdl.c (lt_dlcaller_get_data): Work even when no caller + has set data. + 2007-09-01 Ralf Wildenhues * NEWS: Update. diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index a83a02c6d..7519a4fdc 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -4307,17 +4307,18 @@ lt_dlcaller_get_data (key, handle) LT_DLMUTEX_LOCK (); /* Locate the index of the element with a matching KEY. */ - { - int i; - for (i = 0; handle->caller_data[i].key; ++i) - { - if (handle->caller_data[i].key == key) - { - result = handle->caller_data[i].data; - break; - } - } - } + if (handle->caller_data) + { + int i; + for (i = 0; handle->caller_data[i].key; ++i) + { + if (handle->caller_data[i].key == key) + { + result = handle->caller_data[i].data; + break; + } + } + } LT_DLMUTEX_UNLOCK (); -- 2.47.3