Harbs,

Above statement was true in the previous code were in setter of href were
code which sets data to link. Currently this null check is not necessary,
cause first evaluated is createElement than setter for data. I can remove
both null checks!

Piotr


2017-10-26 23:24 GMT+02:00 Piotr Zarzycki <piotrzarzyck...@gmail.com>:

> Ahh Ok! Let me explain. If you create your custom item renderer something
> like that [1] and set there href - without that null check you will have
> Null Pointer Exception. If you have some other idea how to resolve that I
> would be open to change that!
>
> [1] https://paste.apache.org/emQl
>
> Piotr
>
>
> 2017-10-26 23:21 GMT+02:00 Harbs <harbs.li...@gmail.com>:
>
>> I mean that I don’t understand why you added the null checking. That
>> seems like "just in case". I also don’t understand how a
>> Foot*Link*ItemRenderer could be missing a link element.
>>
>> > On Oct 27, 2017, at 12:13 AM, Piotr Zarzycki <piotrzarzyck...@gmail.com>
>> wrote:
>> >
>> > Hi Harbs,
>> >
>> > You suggesting remove this part [1], and leave to the user setup it if
>> he
>> > want to ? That is what you mean ?
>> >
>> > [1] https://paste.apache.org/8F4x
>> >
>> > Piotr
>> >
>> >
>> > 2017-10-26 23:07 GMT+02:00 Harbs <harbs.li...@gmail.com>:
>> >
>> >> Isn’t this "just in case” code?
>> >>
>> >> Why doesn’t the subclass just override the data setter if it doesn’t
>> have
>> >> a link? (and why doesn’t it have one?)
>> >>
>> >> Harbs
>> >>
>> >>> On Oct 26, 2017, at 11:45 PM, pio...@apache.org wrote:
>> >>>
>> >>> This is an automated email from the ASF dual-hosted git repository.
>> >>>
>> >>> piotrz pushed a commit to branch develop
>> >>> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
>> >>>
>> >>>
>> >>> The following commit(s) were added to refs/heads/develop by this push:
>> >>>    new 37b243e  Fix issue where setting "href" in a custom item
>> >> renderer based on FooterLinkItemRenderer causes NPE
>> >>> 37b243e is described below
>> >>>
>> >>> commit 37b243e5badc88a23816118c86ececb4f0ded96c
>> >>> Author: Piotr Zarzycki <piotrzarzyck...@gmail.com>
>> >>> AuthorDate: Thu Oct 26 22:44:59 2017 +0200
>> >>>
>> >>>   Fix issue where setting "href" in a custom item renderer based on
>> >> FooterLinkItemRenderer causes NPE
>> >>> ---
>> >>> .../royale/mdl/itemRenderers/FooterLinkItemRenderer.as       | 12
>> >> ++++++------
>> >>> 1 file changed, 6 insertions(+), 6 deletions(-)
>> >>>
>> >>> diff --git a/frameworks/projects/MaterialDesignLite/src/main/
>> >> royale/org/apache/royale/mdl/itemRenderers/FooterLinkItemRenderer.as
>> >> b/frameworks/projects/MaterialDesignLite/src/main/
>> >> royale/org/apache/royale/mdl/itemRenderers/FooterLinkItemRenderer.as
>> >>> index 19fd057..babab26 100644
>> >>> --- a/frameworks/projects/MaterialDesignLite/src/main/
>> >> royale/org/apache/royale/mdl/itemRenderers/FooterLinkItemRenderer.as
>> >>> +++ b/frameworks/projects/MaterialDesignLite/src/main/
>> >> royale/org/apache/royale/mdl/itemRenderers/FooterLinkItemRenderer.as
>> >>> @@ -85,11 +85,6 @@ package org.apache.royale.mdl.itemRenderers
>> >>>              public function set href(value:String):void
>> >>>              {
>> >>>            _href = value;
>> >>> -
>> >>> -            COMPILE::JS
>> >>> -            {
>> >>> -                (a as HTMLElement).setAttribute('href', value);
>> >>> -            }
>> >>>              }
>> >>>
>> >>>              COMPILE::JS
>> >>> @@ -121,7 +116,12 @@ package org.apache.royale.mdl.itemRenderers
>> >>>                              if(textNode != null)
>> >>>                              {
>> >>>                                      textNode.nodeValue = text;
>> >>> -                             }
>> >>> +                             }
>> >>> +
>> >>> +                if (a != null)
>> >>> +                {
>> >>> +                    (a as HTMLElement).setAttribute('href', href);
>> >>> +                }
>> >>>                      }
>> >>>              }
>> >>>
>> >>>
>> >>> --
>> >>> To stop receiving notification emails like this one, please contact
>> >>> ['"comm...@royale.apache.org" <comm...@royale.apache.org>'].
>> >>
>> >>
>> >
>> >
>> > --
>> >
>> > Piotr Zarzycki
>> >
>> > mobile: +48 880 859 557
>> > skype: zarzycki10
>> >
>> > LinkedIn: http://www.linkedin.com/piotrzarzycki
>> > <https://pl.linkedin.com/in/piotr-zarzycki-92a53552>
>> >
>> > GitHub: https://github.com/piotrzarzycki21
>>
>>
>
>
> --
>
> Piotr Zarzycki
>
> mobile: +48 880 859 557 <+48%20880%20859%20557>
> skype: zarzycki10
>
> LinkedIn: http://www.linkedin.com/piotrzarzycki
> <https://pl.linkedin.com/in/piotr-zarzycki-92a53552>
>
> GitHub: https://github.com/piotrzarzycki21
>



-- 

Piotr Zarzycki

mobile: +48 880 859 557
skype: zarzycki10

LinkedIn: http://www.linkedin.com/piotrzarzycki
<https://pl.linkedin.com/in/piotr-zarzycki-92a53552>

GitHub: https://github.com/piotrzarzycki21

Reply via email to