From f45af8f826ffe31ed273b9bb3319c4c5fff343a4 Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 1 May 2016 06:22:52 +0200 Subject: [PATCH] fixed bugwith empty loop functions --- coreengine/complextypes.c | 2 -- coreengine/functions.c | 9 +++++++++ coreengine/listelements.c | 8 ++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/coreengine/complextypes.c b/coreengine/complextypes.c index 41feafd..bcc1a50 100644 --- a/coreengine/complextypes.c +++ b/coreengine/complextypes.c @@ -562,9 +562,7 @@ bool cNumericExpr::CacheStatic(void) { expr = ReplacePercentValue(expr); //replace {areawidth} and {areaheight} if (container->Width() >= 0) { - //esyslog("skindesigner: replacing areawidth %s", expr); expr = ReplaceTokens(expr, "{areawidth}", container->Width()); - //esyslog("skindesigner: replaced areawidth %s", expr); } if (container->Height() >= 0) expr = ReplaceTokens(expr, "{areaheight}", container->Height()); diff --git a/coreengine/functions.c b/coreengine/functions.c index 1b089bc..dd5ecfe 100644 --- a/coreengine/functions.c +++ b/coreengine/functions.c @@ -1228,11 +1228,14 @@ void cFuncLoop::Render(cPixmap *p, int x0, int y0, int cw, int rh) { return; } int numRows = tokenContainer->NumLoops(loopIndex); + if (numRows < 1) + return; int columnWidth = GetValue((int)eLoopAttribs::columnwidth); int rowHeight = GetValue((int)eLoopAttribs::rowheight); int maxItems = GetValue((int)eLoopAttribs::maxitems); eOrientation orientation = (eOrientation)GetValue((int)eLoopAttribs::orientation); eOverflowType overflow = (eOverflowType)GetValue((int)eLoopAttribs::overflow); + int loopWidth = Width(); if (loopWidth <= 0) loopWidth = container.Width(); @@ -1300,6 +1303,9 @@ int cFuncLoop::FuncWidth(void) { return 0; } int numLoops = tokenContainer->NumLoops(loopIndex); + if (numLoops < 1) + return 0; + int columnWidth = GetValue((int)eLoopAttribs::columnwidth); if (columnWidth <=0) columnWidth = ColumnWidth(); @@ -1321,6 +1327,9 @@ int cFuncLoop::FuncHeight(void) { return 0; } int numLoops = tokenContainer->NumLoops(loopIndex); + if (numLoops < 1) + return 0; + int rowHeight = GetValue((int)eLoopAttribs::rowheight); if (rowHeight <=0) rowHeight = RowHeight(); diff --git a/coreengine/listelements.c b/coreengine/listelements.c index ccf84af..1d9d015 100644 --- a/coreengine/listelements.c +++ b/coreengine/listelements.c @@ -1122,14 +1122,18 @@ bool cCeMenuChannels::Parse(bool forced) { if (schedule) { for (const cEvent *e = schedule->GetPresentEvent(); e; e = schedule->Events()->Next(e)) { eventsAvailable++; - if (eventsAvailable == 10) + if (eventsAvailable == 12) break; } } + eventsAvailable -= 2; + if (eventsAvailable < 0) + eventsAvailable = 0; + loopInfo.push_back(eventsAvailable); tokenContainer->CreateLoopTokenContainer(&loopInfo); - if (schedule) { + if (schedule && eventsAvailable > 0) { int num = 0; for (const cEvent *e = schedule->GetPresentEvent(); e; e = schedule->Events()->Next(e)) { if (num < 2) {