Przeglądaj źródła

- log a better error message if carrier or domain table is empty at start

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5495 689a6050-402a-0410-94f2-e92a70836424
Henning Westerholt 16 lat temu
rodzic
commit
c441ef000f
1 zmienionych plików z 10 dodań i 0 usunięć
  1. 10 0
      modules/carrierroute/cr_db.c

+ 10 - 0
modules/carrierroute/cr_db.c

@@ -95,6 +95,11 @@ static int load_carrier_map(struct route_data_t *rd) {
 	}
 
 	count = RES_ROW_N(res);
+	if (count == 0) {
+		LM_ERR("empty %.*s table", carrier_name_table.len, carrier_name_table.s);
+		carrierroute_dbf.free_result(carrierroute_dbh, res);
+		return 0;
+	}
 
 	rd->carrier_map = shm_malloc(sizeof(struct name_map_t) * count);
 	if (rd->carrier_map == NULL) {
@@ -146,6 +151,11 @@ static int load_domain_map(struct route_data_t *rd) {
 	}
 
 	count = RES_ROW_N(res);
+	if (count == 0) {
+		LM_ERR("empty %.*s table", domain_name_table.len, domain_name_table.s);
+		carrierroute_dbf.free_result(carrierroute_dbh, res);
+		return 0;
+	}
 
 	rd->domain_map = shm_malloc(sizeof(struct name_map_t) * count);
 	if (rd->domain_map == NULL) {