Module: kamailio
Branch: 4.2
Commit: af2e7c59e2a1ae020481ba2b7c601cebb701edf4
URL: 
https://github.com/kamailio/kamailio/commit/af2e7c59e2a1ae020481ba2b7c601cebb701edf4

Author: Mikko Lehto <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2015-07-29T12:34:33+02:00

modules/htable: improves error message when loading from database

(cherry picked from commit f39736b276878f0de1e0471311119f12f1878801)
(cherry picked from commit 48996cc1e879a2abf96306fc69ace2a86b8ef836)

---

Modified: modules/htable/ht_db.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/af2e7c59e2a1ae020481ba2b7c601cebb701edf4.diff
Patch: 
https://github.com/kamailio/kamailio/commit/af2e7c59e2a1ae020481ba2b7c601cebb701edf4.patch

---

diff --git a/modules/htable/ht_db.c b/modules/htable/ht_db.c
index 0231ece..fd1ffad 100644
--- a/modules/htable/ht_db.c
+++ b/modules/htable/ht_db.c
@@ -198,11 +198,17 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
        do {
                for(i=0; i<RES_ROW_N(db_res); i++)
                {
-                       if(RES_ROWS(db_res)[i].values[0].type!=DB1_STRING
-                                       || 
VAL_NULL(&RES_ROWS(db_res)[i].values[0])) {
-                               LM_ERR("key type must be string and its value 
not null\n");
+                       if(VAL_NULL(&RES_ROWS(db_res)[i].values[0])) {
+                               LM_ERR("key value must not be null\n");
                                goto error;
                        }
+
+                       if(RES_ROWS(db_res)[i].values[0].type!=DB1_STRING) {
+                               LM_ERR("key type must be string (type=%d)\n",
+                                               
RES_ROWS(db_res)[i].values[0].type);
+                               goto error;
+                       }
+
                        kname.s = 
(char*)(RES_ROWS(db_res)[i].values[0].val.string_val);
                        if(kname.s==NULL) {
                                LM_ERR("null key in row %d\n", i);


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to