Correctly handle the error case where the CodecId has a negative value
Negative values should be treated the same as too-large positive values: by returning an empty Maybe. TBR=henrik.lundin@webrtc.org Review URL: https://codereview.webrtc.org/1407383010 Cr-Commit-Position: refs/heads/master@{#10509}
This commit is contained in:
@ -133,8 +133,8 @@ class RentACodec {
|
||||
|
||||
static inline rtc::Maybe<int> CodecIndexFromId(CodecId codec_id) {
|
||||
const int i = static_cast<int>(codec_id);
|
||||
return i < static_cast<int>(NumberOfCodecs()) ? rtc::Maybe<int>(i)
|
||||
: rtc::Maybe<int>();
|
||||
return i >= 0 && i < static_cast<int>(NumberOfCodecs()) ? rtc::Maybe<int>(i)
|
||||
: rtc::Maybe<int>();
|
||||
}
|
||||
|
||||
static inline rtc::Maybe<CodecId> CodecIdFromIndex(int codec_index) {
|
||||
|
||||
Reference in New Issue
Block a user