summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorpdw <>2014-01-01 14:37:31 +0000
committerpdw <>2014-01-01 14:37:31 +0000
commita9663192567697bfb217704cd67c34fd32a68389 (patch)
tree519a7c9cbc7d65b17d3c0a017f0de404be448326 /hash.c
parent59cf360690c99ad5149305ce3600151fa0f1483b (diff)
downloadiftop-a9663192567697bfb217704cd67c34fd32a68389.zip
Patch for text output mode by originally by Patrik Bless, updated by Roman Hoog
Antink <rha@open.ch>
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index 540af8e..1c500f1 100644
--- a/hash.c
+++ b/hash.c
@@ -76,6 +76,11 @@ hash_status_enum hash_find(hash_type* hash_table, void* key, void **rec) {
hash_status_enum hash_next_item(hash_type* hash_table, hash_node_type** ppnode) {
int i;
+
+ if (hash_table == 0) {
+ return HASH_STATUS_KEY_NOT_FOUND;
+ }
+
if(*ppnode != NULL) {
if((*ppnode)->next != NULL) {
*ppnode = (*ppnode)->next;
@@ -101,6 +106,11 @@ hash_status_enum hash_next_item(hash_type* hash_table, hash_node_type** ppnode)
void hash_delete_all(hash_type* hash_table) {
int i;
hash_node_type *n, *nn;
+
+ if(hash_table == 0) {
+ return;
+ }
+
for(i = 0; i < hash_table->size; i++) {
n = hash_table->table[i];
while(n != NULL) {