viewer: return null params if not in array

Suppresses warning about input array sizes.
This commit is contained in:
itsmattkc
2021-04-13 15:40:27 +10:00
parent 46e00c0099
commit 76eb117a45
+14 -2
View File
@@ -72,12 +72,24 @@ public:
VideoParams GetVideoParams(int index = 0) const
{
return GetStandardValue(kVideoParamsInput, index).value<VideoParams>();
// This check isn't strictly necessary (GetStandardValue will return a null VideoParams anyway),
// but it does suppress a warning message that we don't need
if (index < InputArraySize(kVideoParamsInput)) {
return GetStandardValue(kVideoParamsInput, index).value<VideoParams>();
} else {
return VideoParams();
}
}
AudioParams GetAudioParams(int index = 0) const
{
return GetStandardValue(kAudioParamsInput, index).value<AudioParams>();
// This check isn't strictly necessary (GetStandardValue will return a null VideoParams anyway),
// but it does suppress a warning message that we don't need
if (index < InputArraySize(kAudioParamsInput)) {
return GetStandardValue(kAudioParamsInput, index).value<AudioParams>();
} else {
return AudioParams();
}
}
void SetVideoParams(const VideoParams &video, int index = 0)