diff --git a/examples/tv-app/linux/include/channel/ChannelManager.cpp b/examples/tv-app/linux/include/channel/ChannelManager.cpp index 5156cd3d096945..3f49a3a81bf26e 100644 --- a/examples/tv-app/linux/include/channel/ChannelManager.cpp +++ b/examples/tv-app/linux/include/channel/ChannelManager.cpp @@ -179,15 +179,11 @@ bool ChannelManager::HandleSkipChannel(const int16_t & count) uint16_t channelsSize = static_cast(mChannels.size()); // handle larger than maximum -> channel size case - if (newChannelIndex >= channelsSize) - { - newChannelIndex = newChannelIndex % channelsSize; - } + newChannelIndex = newChannelIndex % channelsSize; - // handle smaller than 0 if (newChannelIndex < 0) { - newChannelIndex = (newChannelIndex % channelsSize) % channelsSize; + newChannelIndex = (newChannelIndex + channelsSize) % channelsSize; } mCurrentChannelIndex = static_cast(newChannelIndex);