ソースを参照

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
Lupus 20 年 前
コミット
fffdff7512
1 ファイル変更5 行追加1 行削除
  1. 5 1
      src/common/db.c

+ 5 - 1
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;