Skip to content

Commit

Permalink
viewer: return null params if not in array
Browse files Browse the repository at this point in the history
Suppresses warning about input array sizes.
  • Loading branch information
itsmattkc committed Apr 13, 2021
1 parent 46e00c0 commit 76eb117
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/node/output/viewer/viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,24 @@ class ViewerOutput : public Node

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)
Expand Down

0 comments on commit 76eb117

Please sign in to comment.