Ensure play url is valid(#4114)

Play url could be empty.
This commit is contained in:
N.z 2025-01-19 18:35:22 +08:00 committed by GitHub
parent f3026f5df0
commit 83a622fa25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,7 +37,13 @@ PlayerBase::Ptr PlayerBase::createPlayer(const EventPoller::Ptr &in_poller, cons
delete ptr;
}
};
string url = url_in;
trim(url);
if (url.empty()) {
throw std::invalid_argument("invalid play url: " + url_in);
}
string prefix = findSubString(url.data(), NULL, "://");
auto pos = url.find('?');
if (pos != string::npos) {