diff --git a/lib/src/HttpAppFrameworkImpl.cc b/lib/src/HttpAppFrameworkImpl.cc index 8d11a5ff..964a342c 100755 --- a/lib/src/HttpAppFrameworkImpl.cc +++ b/lib/src/HttpAppFrameworkImpl.cc @@ -521,7 +521,7 @@ void HttpAppFrameworkImpl::doFilterChain(const std::shared_ptr &missCallback) { - if (chain->size() > 0) + if (chain && chain->size() > 0) { auto filter = chain->front(); chain->pop(); @@ -542,18 +542,20 @@ void HttpAppFrameworkImpl::doFilters(const std::vector &filters, const std::string &session_id, const std::function &missCallback) { - LOG_TRACE << "filters count:" << filters.size(); - std::shared_ptr>> filterPtrs = - std::make_shared>>(); - for (auto filter : filters) + std::shared_ptr>> filterPtrs; + if (!filters.empty()) { - auto _object = std::shared_ptr(DrClassMap::newObject(filter)); - auto _filter = std::dynamic_pointer_cast(_object); - if (_filter) - filterPtrs->push(_filter); - else + filterPtrs = std::make_shared>>(); + for (auto &filter : filters) { - LOG_ERROR << "filter " << filter << " not found"; + auto _object = std::shared_ptr(DrClassMap::newObject(filter)); + auto _filter = std::dynamic_pointer_cast(_object); + if (_filter) + filterPtrs->push(_filter); + else + { + LOG_ERROR << "filter " << filter << " not found"; + } } } doFilterChain(filterPtrs, req, callback, needSetJsessionid, session_id, missCallback);