diff --git a/lib/ivis_opengl/pieimage.cpp b/lib/ivis_opengl/pieimage.cpp index 7e6425e6633..3a9665b20a9 100644 --- a/lib/ivis_opengl/pieimage.cpp +++ b/lib/ivis_opengl/pieimage.cpp @@ -418,6 +418,7 @@ bool iV_Image::convert_channels(const std::vector& channelMap) ASSERT_OR_RETURN(false, channelMap.size() <= 4, "iV_Image does not support > 4 channel textures (channelMap has %zu entries)", channelMap.size()); auto originalChannels = m_channels; ASSERT_OR_RETURN(false, std::all_of(channelMap.begin(), channelMap.end(), [originalChannels](unsigned int srcChannel){ return srcChannel < originalChannels; }), "Channel swizzle contains channel > originalChannels (%u)", m_channels); + ASSERT_OR_RETURN(false, m_width > 0 && m_height > 0, "No size"); unsigned int newChannels = static_cast(channelMap.size()); @@ -440,6 +441,7 @@ bool iV_Image::convert_channels(const std::vector& channelMap) bool iV_Image::convert_to_single_channel(unsigned int channel /*= 0*/) { ASSERT_OR_RETURN(false, channel < m_channels, "Cannot extract channel %u from image with %u channels", channel, m_channels); + ASSERT_OR_RETURN(false, m_width > 0 && m_height > 0, "No size"); if (channel == 0 && m_channels == 1) { // nothing to do