1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix the empty config error

This commit is contained in:
winlin 2014-07-20 17:08:47 +08:00
parent 75bfe2af78
commit 0db2e6b8e9
3 changed files with 37 additions and 1 deletions

View file

@ -1182,6 +1182,13 @@ int SrsConfig::parse_buffer(_srs_internal::SrsConfigBuffer* buffer)
if ((ret = root->parse(buffer)) != ERROR_SUCCESS) {
return ret;
}
// check empty
if (root->directives.size() == 0) {
ret = ERROR_SYSTEM_CONFIG_INVALID;
srs_error("conf is empty, ret=%d", ret);
return ret;
}
// check root directives.
for (int i = 0; i < (int)root->directives.size(); i++) {
@ -1200,7 +1207,7 @@ int SrsConfig::parse_buffer(_srs_internal::SrsConfigBuffer* buffer)
}
// check rtmp port specified by directive listen.
if (_srs_config->get_listen().size() <= 0) {
if (get_listen().size() <= 0) {
ret = ERROR_SYSTEM_CONFIG_INVALID;
srs_error("directive \"listen\" is empty, ret=%d", ret);
return ret;