CComponentsChannelLogo: use separat var for pic name inside setChannel()

picname is a class attribut and should not be touched here till new content
exists. Btw. setChannel() is eqiuvalent to setPicture() from base class, so
it makes sense to use setPicture() inside setChannel() after
picname is known. Explicit call of initCCTitem() is not required.
This commit is contained in:
2017-04-16 16:53:06 +02:00
parent f4762f78a5
commit 29a01bd2d8

View File

@@ -416,6 +416,8 @@ void CComponentsChannelLogo::setAltLogo(const char* picture_name)
void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName)
{
need_init = true;
string image = pic_name;
if (channelId || !channelName.empty()){
if ((channel_id == channelId) && (channel_name == channelName))
need_init = false;
@@ -426,16 +428,16 @@ void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::st
int dummy;
has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, pic_name, &dummy, &dummy);
has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, image, &dummy, &dummy);
if (!has_logo)//no logo was found, use altrenate icon or logo
pic_name = alt_pic_name;
image = alt_pic_name;
//if logo or alternate image still not available, set has logo to false
has_logo = !pic_name.empty();
has_logo = !image.empty();
//refresh object
initCCItem();
setPicture(image);
//set has_logo to false if no dimensions were detected
if (width && height)