summaryrefslogtreecommitdiff
path: root/main/event.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2010-02-08 23:43:00 +0000
committerRussell Bryant <russell@russellbryant.com>2010-02-08 23:43:00 +0000
commitf2282722dd92eb8649120c4e03c12429ad842a8d (patch)
tree854e195effb342d01bd1dc51a2d4f502cd85b510 /main/event.c
parent38ed79a0761a70c5d256daf36f62f6a146d76305 (diff)
Fix return value of get_ie_str() and get_ie_str_hash() for non-existent IE.
I found this bug while developing a unit test for event allocation. Testing is awesome. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245624 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/event.c')
-rw-r--r--main/event.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/main/event.c b/main/event.c
index 7f29783b9..7a953c508 100644
--- a/main/event.c
+++ b/main/event.c
@@ -945,7 +945,7 @@ const char *ast_event_iterator_get_ie_str(struct ast_event_iterator *iterator)
str_payload = (struct ast_event_ie_str_payload *) iterator->ie->ie_payload;
- return str_payload->str;
+ return str_payload ? str_payload->str : NULL;
}
void *ast_event_iterator_get_ie_raw(struct ast_event_iterator *iterator)
@@ -982,7 +982,7 @@ uint32_t ast_event_get_ie_str_hash(const struct ast_event *event, enum ast_event
str_payload = ast_event_get_ie_raw(event, ie_type);
- return str_payload->hash;
+ return str_payload ? str_payload->hash : 0;
}
const char *ast_event_get_ie_str(const struct ast_event *event, enum ast_event_ie_type ie_type)
@@ -991,7 +991,7 @@ const char *ast_event_get_ie_str(const struct ast_event *event, enum ast_event_i
str_payload = ast_event_get_ie_raw(event, ie_type);
- return str_payload->str;
+ return str_payload ? str_payload->str : NULL;
}
const void *ast_event_get_ie_raw(const struct ast_event *event, enum ast_event_ie_type ie_type)