Medium Complex iif statement in skin can hang MP (1 Viewer)

mbuzina

Retired Team Member
  • Premium Supporter
  • April 11, 2005
    2,839
    726
    Germany
    Home Country
    Germany Germany
    MediaPortal Version: 1.4.0

    Description
    Here I am again with another Skin Enging Bug report ;-). If there is a @Developers willing to work close together to improve the skin engine for 1.5, I am here. To this bug:

    You can hang the skin engine (without much in the log, is attached) by adding a simple control to the BasicHome (would work on any skin file I guess) which has a choose statement along with comparisons in it. MP will hang on Initializing Window Manager.

    Steps to Reproduce:
    Add the following control to BasicHome.xml of your preferred skin (tried with DefaultWide):


    Code:
    <control>
    		<description>Year / Genre</description>
    		<type>label</type>
    		<posX>400</posX>
    		<posY>340</posY>
    		<width>150</width>
    		<textcolor>FF007ACC</textcolor>
    		<label>#(choose(
    			eq(#Play.Current.Year,''),#Play.Current.Genre),
    			eq(#Play.Current.Genre,''),#Play.Current.Year,
    			eq(1,1),string.format('{0} - {1}',#Play.Current.Genre,#Play.Current.Year
    		))</label>
    	</control>

    and start MP. It will hang on start (it does with me).
     
    Last edited:

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    Shouldn't it be:
    Code:
    <control>
    		<description>Year / Genre</description>
    		<type>label</type>
    		<posX>400</posX>
    		<posY>340</posY>
    		<width>150</width>
    		<textcolor>FF007ACC</textcolor>
    		<label>#(choose(
    			eq(#Play.Current.Year,''),#Play.Current.Genre,
    			eq(#Play.Current.Genre,''),#Play.Current.Year,
    			eq(1,1),string.format('{0} - {1}',#Play.Current.Genre,#Play.Current.Year)
    		))</label>
    	</control>
    (removed extraneous parenthesis after #Play.Current.Genre on line 2 and added missing parenthesis after #Play.Current.Year on line 4)

    Ofc, skin engine shouldn't hang, it should just return a syntax error.

    Also you don't need eq(1,1) you can use true instead
     

    Pog

    Retired Team Member
  • Premium Supporter
  • September 7, 2009
    401
    315
    Wicklow
    Home Country
    Ireland Ireland
    I'll add that it should be a switch instruction and not choose as that is for index based lookups.

    Also true will not work in a switch statement, yes it looks like that's the right way to do it but the skin engine expects a logic statement there so eq(1,1) is the only way to make it work.
     
    Last edited:

    mbuzina

    Retired Team Member
  • Premium Supporter
  • April 11, 2005
    2,839
    726
    Germany
    Home Country
    Germany Germany
    Aaaaaahh

    Too many items at the same time. I guess you are right (sorry)
     

    Users who are viewing this thread

    Top Bottom