Browse Source

imc: better condition to catch no result of database query

Daniel-Constantin Mierla 10 years ago
parent
commit
29d7ca71fd
1 changed files with 2 additions and 2 deletions
  1. 2 2
      modules/imc/imc.c

+ 2 - 2
modules/imc/imc.c

@@ -200,10 +200,10 @@ int add_from_db(void)
 		LM_ERR("failed to querry table\n");
 		return -1;
 	}
-	if(r_res && r_res->n<=0)
+	if(r_res==NULL || r_res->n<=0)
 	{
 		LM_INFO("the query returned no result\n");
-		imc_dbf.free_result(imc_db, r_res);
+		if(r_res) imc_dbf.free_result(imc_db, r_res);
 		r_res = NULL;
 		return 0;
 	}