Browse Source

htable: test if there is a db table associated with htable for rpc reload

Daniel-Constantin Mierla 7 years ago
parent
commit
79c16cd9bd
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/modules/htable/htable.c

+ 6 - 1
src/modules/htable/htable.c

@@ -1156,7 +1156,12 @@ static void htable_rpc_reload(rpc_t* rpc, void* c)
 		rpc->fault(c, 500, "No such htable");
 		return;
 	}
-
+	if(ht->dbtable.s==NULL || ht->dbtable.len<=0)
+	{
+		ht_db_close_con();
+		rpc->fault(c, 500, "No database htable");
+		return;
+	}
 
 	memcpy(&nht, ht, sizeof(ht_t));
 	/* it's temporary operation - use system malloc */