Module: sems
Branch: master
Commit: 358be0b844d4e7d2ba2a7caaad5f283aea263d3c
URL: 
https://github.com/sems-server/sems/commit/358be0b844d4e7d2ba2a7caaad5f283aea263d3c

Author: Juha Heinanen <j...@tutpro.com>
Committer: Juha Heinanen <j...@tutpro.com>
Date: 2015-11-14T13:26:49+02:00

apps/dsm/mods/mod_mysql: added check on empty audio data in
  playDBAudio function

---

Modified: apps/dsm/mods/mod_mysql/ModMysql.cpp
Modified: apps/dsm/mods/mod_mysql/ModMysql.h

---

Diff:  
https://github.com/sems-server/sems/commit/358be0b844d4e7d2ba2a7caaad5f283aea263d3c.diff
Patch: 
https://github.com/sems-server/sems/commit/358be0b844d4e7d2ba2a7caaad5f283aea263d3c.patch

---

diff --git a/apps/dsm/mods/mod_mysql/ModMysql.cpp 
b/apps/dsm/mods/mod_mysql/ModMysql.cpp
index 6ffd0e0..caed715 100644
--- a/apps/dsm/mods/mod_mysql/ModMysql.cpp
+++ b/apps/dsm/mods/mod_mysql/ModMysql.cpp
@@ -474,6 +474,11 @@ bool playDBAudio(AmSession* sess, DSMSession* sc_sess, 
DSMCondition::EventType e
        sc_sess->SET_STRERROR("result does not have row");
        EXEC_ACTION_STOP;
       }
+      if (row.at(0).size() == 0) {
+       sc_sess->SET_ERRNO(DSM_ERRNO_MY_NODATA);
+       sc_sess->SET_STRERROR("result does not have data");
+       EXEC_ACTION_STOP;
+      }
       FILE *t_file = tmpfile();
       if (NULL == t_file) {
        sc_sess->SET_ERRNO(DSM_ERRNO_FILE);
diff --git a/apps/dsm/mods/mod_mysql/ModMysql.h 
b/apps/dsm/mods/mod_mysql/ModMysql.h
index 7bf13fb..06737b4 100644
--- a/apps/dsm/mods/mod_mysql/ModMysql.h
+++ b/apps/dsm/mods/mod_mysql/ModMysql.h
@@ -39,6 +39,7 @@
 #define DSM_ERRNO_MY_NORESULT   "result"
 #define DSM_ERRNO_MY_NOROW      "result"
 #define DSM_ERRNO_MY_NOCOLUMN   "result"
+#define DSM_ERRNO_MY_NODATA     "result"
 
 class SCMysqlModule 
 : public DSMModule {

_______________________________________________
Semsdev mailing list
Semsdev@lists.iptel.org
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to