Bug 1150966: Check whether |streams_| is null on stats methods in NrIceMediaStream. r=drno

--HG--
extra : rebase_source : 38f61e496d3b2ad7d7a0c72e141490deaa04b538
extra : source : ab93f4716296c85ce4953ee87be1bfa728a7cbb9
This commit is contained in:
Byron Campen [:bwc] 2015-04-03 11:13:44 -07:00
Родитель aad5b35ad2
Коммит da2ef8fa74
1 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -248,6 +248,10 @@ nsresult NrIceMediaStream::GetActivePair(int component,
nr_ice_candidate *local_int; nr_ice_candidate *local_int;
nr_ice_candidate *remote_int; nr_ice_candidate *remote_int;
if (!stream_) {
return NS_ERROR_NOT_AVAILABLE;
}
r = nr_ice_media_stream_get_active(ctx_->peer(), r = nr_ice_media_stream_get_active(ctx_->peer(),
stream_, stream_,
component, component,
@ -281,6 +285,9 @@ nsresult NrIceMediaStream::GetActivePair(int component,
nsresult NrIceMediaStream::GetCandidatePairs(std::vector<NrIceCandidatePair>* nsresult NrIceMediaStream::GetCandidatePairs(std::vector<NrIceCandidatePair>*
out_pairs) const { out_pairs) const {
MOZ_ASSERT(out_pairs); MOZ_ASSERT(out_pairs);
if (!stream_) {
return NS_ERROR_NOT_AVAILABLE;
}
// Get the check_list on the peer stream (this is where the check_list // Get the check_list on the peer stream (this is where the check_list
// actually lives, not in stream_) // actually lives, not in stream_)
@ -366,6 +373,10 @@ std::vector<std::string> NrIceMediaStream::GetCandidates() const {
int r; int r;
std::vector<std::string> ret; std::vector<std::string> ret;
if (!stream_) {
return ret;
}
r = nr_ice_media_stream_get_attributes(stream_, r = nr_ice_media_stream_get_attributes(stream_,
&attrs, &attrct); &attrs, &attrct);
if (r) { if (r) {
@ -412,11 +423,19 @@ static nsresult GetCandidatesFromStream(
nsresult NrIceMediaStream::GetLocalCandidates( nsresult NrIceMediaStream::GetLocalCandidates(
std::vector<NrIceCandidate>* candidates) const { std::vector<NrIceCandidate>* candidates) const {
if (!stream_) {
return NS_ERROR_NOT_AVAILABLE;
}
return GetCandidatesFromStream(stream_, candidates); return GetCandidatesFromStream(stream_, candidates);
} }
nsresult NrIceMediaStream::GetRemoteCandidates( nsresult NrIceMediaStream::GetRemoteCandidates(
std::vector<NrIceCandidate>* candidates) const { std::vector<NrIceCandidate>* candidates) const {
if (!stream_) {
return NS_ERROR_NOT_AVAILABLE;
}
nr_ice_media_stream* peer_stream; nr_ice_media_stream* peer_stream;
int r = nr_ice_peer_ctx_find_pstream(ctx_->peer(), stream_, &peer_stream); int r = nr_ice_peer_ctx_find_pstream(ctx_->peer(), stream_, &peer_stream);
if (r != 0) { if (r != 0) {