From fffdff7512dd6a30613a831b8f36ccb4e9dea7c7 Mon Sep 17 00:00:00 2001 From: Lupus Date: Thu, 16 Dec 2004 18:24:03 +0000 Subject: [PATCH] added null pointer check from freya git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@588 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/db.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/db.c b/src/common/db.c index 58f0ea4f7e..304165fc2d 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -441,7 +441,11 @@ void db_foreach(struct dbt *table,int (*func)(void*,void*,va_list),...) continue; sp=0; while(1){ - func(p->key,p->data,ap); + if (!p->data) { + printf("Warning: no data for key %d in db_foreach (db.c) !\n",p->key); + } else { + func(p->key, p->data, ap); + } if((pn=p->left)!=NULL){ if(p->right){ stack[sp++]=p->right;