You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Piotr Zarzycki <pi...@gmail.com> on 2020/12/02 20:42:32 UTC

ListView scrollToIndex throwing NPE

Hello Carlos,

With newest update in Royale we are getting NPE in following line of code
[1]

Essentially dataProvider is null here [1].

Scenario is following:
1) Add DataGrid with couple of items
2) Once it's displayed set dataProvider = null

In that case scrollToIndex gets -1 - it will be called with
scrollToIndex(-1) and variableRowHeight = false. That part [1] of the code
will be called and nulled dataProvider - causes mentioned issue.

[1]
https://github.com/apache/royale-asjs/blob/7ab8307b561712560b675e31b0e6e1e71fa05d78/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ListView.as#L215

Thanks,
-- 

Piotr Zarzycki

Re: ListView scrollToIndex throwing NPE

Posted by Piotr Zarzycki <pi...@gmail.com>.
Thanks! Will do that! :)

czw., 3 gru 2020 o 10:52 Carlos Rovira <ca...@apache.org> napisał(a):

> Hi,
>
> I think it's worth a try and then check TDJ and see if all continue to work
> as expected.
>
> El mié, 2 dic 2020 a las 23:32, Piotr Zarzycki (<piotrzarzycki21@gmail.com
> >)
> escribió:
>
> > Hi Carlos,
> >
> > Yes that is a null check, but I was also wondering whether actually fix
> > shouldn’t be a check of
> >
> > If (index == -1) return false at the beginning of the function.
> >
> > It will for sure fix issue but what may implications be.
> >
> > On Wed, 2 Dec 2020 at 22:52, Carlos Rovira <ca...@apache.org>
> > wrote:
> >
> > > Hi Piotr,
> > >
> > > since you have a use case to test and TDJ, can you add a patch
> yourself?
> > > for what you say it seems something to check for null or something like
> > > that?
> > > If you need more help I can take a look, but I'm these days a bit busy
> > >
> > > thanks
> > >
> > >
> > >
> > > El mié, 2 dic 2020 a las 21:43, Piotr Zarzycki (<
> > piotrzarzycki21@gmail.com
> > > >)
> > > escribió:
> > >
> > > > Hello Carlos,
> > > >
> > > > With newest update in Royale we are getting NPE in following line of
> > code
> > > > [1]
> > > >
> > > > Essentially dataProvider is null here [1].
> > > >
> > > > Scenario is following:
> > > > 1) Add DataGrid with couple of items
> > > > 2) Once it's displayed set dataProvider = null
> > > >
> > > > In that case scrollToIndex gets -1 - it will be called with
> > > > scrollToIndex(-1) and variableRowHeight = false. That part [1] of the
> > > code
> > > > will be called and nulled dataProvider - causes mentioned issue.
> > > >
> > > > [1]
> > > >
> > > >
> > >
> >
> https://github.com/apache/royale-asjs/blob/7ab8307b561712560b675e31b0e6e1e71fa05d78/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ListView.as#L215
> > > >
> > > > Thanks,
> > > > --
> > > >
> > > > Piotr Zarzycki
> > > >
> > >
> > >
> > > --
> > > Carlos Rovira
> > > Apache Member & Apache Royale PMC
> > > *Apache Software Foundation*
> > > http://about.me/carlosrovira
> > >
> > --
> >
> > Piotr Zarzycki
> >
>
>
> --
> Carlos Rovira
> Apache Member & Apache Royale PMC
> *Apache Software Foundation*
> http://about.me/carlosrovira
>


-- 

Piotr Zarzycki

Re: ListView scrollToIndex throwing NPE

Posted by Carlos Rovira <ca...@apache.org>.
Hi,

I think it's worth a try and then check TDJ and see if all continue to work
as expected.

El mié, 2 dic 2020 a las 23:32, Piotr Zarzycki (<pi...@gmail.com>)
escribió:

> Hi Carlos,
>
> Yes that is a null check, but I was also wondering whether actually fix
> shouldn’t be a check of
>
> If (index == -1) return false at the beginning of the function.
>
> It will for sure fix issue but what may implications be.
>
> On Wed, 2 Dec 2020 at 22:52, Carlos Rovira <ca...@apache.org>
> wrote:
>
> > Hi Piotr,
> >
> > since you have a use case to test and TDJ, can you add a patch yourself?
> > for what you say it seems something to check for null or something like
> > that?
> > If you need more help I can take a look, but I'm these days a bit busy
> >
> > thanks
> >
> >
> >
> > El mié, 2 dic 2020 a las 21:43, Piotr Zarzycki (<
> piotrzarzycki21@gmail.com
> > >)
> > escribió:
> >
> > > Hello Carlos,
> > >
> > > With newest update in Royale we are getting NPE in following line of
> code
> > > [1]
> > >
> > > Essentially dataProvider is null here [1].
> > >
> > > Scenario is following:
> > > 1) Add DataGrid with couple of items
> > > 2) Once it's displayed set dataProvider = null
> > >
> > > In that case scrollToIndex gets -1 - it will be called with
> > > scrollToIndex(-1) and variableRowHeight = false. That part [1] of the
> > code
> > > will be called and nulled dataProvider - causes mentioned issue.
> > >
> > > [1]
> > >
> > >
> >
> https://github.com/apache/royale-asjs/blob/7ab8307b561712560b675e31b0e6e1e71fa05d78/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ListView.as#L215
> > >
> > > Thanks,
> > > --
> > >
> > > Piotr Zarzycki
> > >
> >
> >
> > --
> > Carlos Rovira
> > Apache Member & Apache Royale PMC
> > *Apache Software Foundation*
> > http://about.me/carlosrovira
> >
> --
>
> Piotr Zarzycki
>


-- 
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira

Re: ListView scrollToIndex throwing NPE

Posted by Piotr Zarzycki <pi...@gmail.com>.
Hi Carlos,

Yes that is a null check, but I was also wondering whether actually fix
shouldn’t be a check of

If (index == -1) return false at the beginning of the function.

It will for sure fix issue but what may implications be.

On Wed, 2 Dec 2020 at 22:52, Carlos Rovira <ca...@apache.org> wrote:

> Hi Piotr,
>
> since you have a use case to test and TDJ, can you add a patch yourself?
> for what you say it seems something to check for null or something like
> that?
> If you need more help I can take a look, but I'm these days a bit busy
>
> thanks
>
>
>
> El mié, 2 dic 2020 a las 21:43, Piotr Zarzycki (<piotrzarzycki21@gmail.com
> >)
> escribió:
>
> > Hello Carlos,
> >
> > With newest update in Royale we are getting NPE in following line of code
> > [1]
> >
> > Essentially dataProvider is null here [1].
> >
> > Scenario is following:
> > 1) Add DataGrid with couple of items
> > 2) Once it's displayed set dataProvider = null
> >
> > In that case scrollToIndex gets -1 - it will be called with
> > scrollToIndex(-1) and variableRowHeight = false. That part [1] of the
> code
> > will be called and nulled dataProvider - causes mentioned issue.
> >
> > [1]
> >
> >
> https://github.com/apache/royale-asjs/blob/7ab8307b561712560b675e31b0e6e1e71fa05d78/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ListView.as#L215
> >
> > Thanks,
> > --
> >
> > Piotr Zarzycki
> >
>
>
> --
> Carlos Rovira
> Apache Member & Apache Royale PMC
> *Apache Software Foundation*
> http://about.me/carlosrovira
>
-- 

Piotr Zarzycki

Re: ListView scrollToIndex throwing NPE

Posted by Carlos Rovira <ca...@apache.org>.
Hi Piotr,

since you have a use case to test and TDJ, can you add a patch yourself?
for what you say it seems something to check for null or something like
that?
If you need more help I can take a look, but I'm these days a bit busy

thanks



El mié, 2 dic 2020 a las 21:43, Piotr Zarzycki (<pi...@gmail.com>)
escribió:

> Hello Carlos,
>
> With newest update in Royale we are getting NPE in following line of code
> [1]
>
> Essentially dataProvider is null here [1].
>
> Scenario is following:
> 1) Add DataGrid with couple of items
> 2) Once it's displayed set dataProvider = null
>
> In that case scrollToIndex gets -1 - it will be called with
> scrollToIndex(-1) and variableRowHeight = false. That part [1] of the code
> will be called and nulled dataProvider - causes mentioned issue.
>
> [1]
>
> https://github.com/apache/royale-asjs/blob/7ab8307b561712560b675e31b0e6e1e71fa05d78/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ListView.as#L215
>
> Thanks,
> --
>
> Piotr Zarzycki
>


-- 
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira