Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2237] Android: TiUIScrollableView showPager() Assumes !null

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:58:30.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M05
ComponentsAndroid
Labelsandroid, defect, release-1.6.0
ReporterDon Thorp
AssigneeDon Thorp
Created2011-04-15T03:14:26.000+0000
Updated2011-04-17T01:58:30.000+0000

Description

On 1_4_X branch line 84 http://github.com/appcelerator/titanium_mobile/blob/1_4_X/android/modules/ui/src/ti/modules/titanium/ui/widget/TiUIScrollableView.java"> TiUIScrollableView.java the showPager method assumes that the scrollable view has "showPagingControl" as a property.

Using the trackball on a G1 caused a customer app to crash with a NPE. See http://developer.appcelerator.com/helpdesk/view/52401">Helpdesk 52401

~~~

E/TiUncaughtHandler( 919): (main) [2072,15484] Sending event: exception on thread: main msg:java.lang.NullPointerException
E/TiUncaughtHandler( 919): java.lang.NullPointerException
E/TiUncaughtHandler( 919): at org.appcelerator.titanium.util.TiConvert.toBoolean(TiConvert.java:223)
E/TiUncaughtHandler( 919): at ti.modules.titanium.ui.widget.TiUIScrollableView.showPager(TiUIScrollableView.java:84)
E/TiUncaughtHandler( 919): at ti.modules.titanium.ui.ScrollableViewProxy.handleMessage(ScrollableViewProxy.java:69)
E/TiUncaughtHandler( 919): at android.os.Handler.dispatchMessage(Handler.java:95)
E/TiUncaughtHandler( 919): at android.os.Looper.loop(Looper.java:123)
E/TiUncaughtHandler( 919): at android.app.ActivityThread.main(ActivityThread.java:4203)
E/TiUncaughtHandler( 919): at java.lang.reflect.Method.invokeNative(Native Method)
E/TiUncaughtHandler( 919): at java.lang.reflect.Method.invoke(Method.java:521)
E/TiUncaughtHandler( 919): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/TiUncaughtHandler( 919): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/TiUncaughtHandler( 919): at dalvik.system.NativeStart.main(Native Method)
~~~

Attachments

FileDateSize
app.js2011-04-15T03:14:27.000+00001971

Comments

  1. Don Thorp 2011-04-15

    Was in wrong milestone.

  2. Opie Cyrus 2011-04-15

    (from [2d56a930ddc126adc94f3bbb8dcabe3fb5086f66]) [#2237 state:fixed-in-qa] updated ScrollableView to check for null view

    scrollableView checks for null view before trying to show pagingControl
    https://github.com/appcelerator/titanium_mobile/commit/2d56a930ddc126adc94f3bbb8dcabe3fb5086f66"> https://github.com/appcelerator/titanium_mobile/commit/2d56a930ddc1...

  3. Opie Cyrus 2011-04-15

    Test app attached. Steps to verify fix:
    1) Run test app
    2) Click on "Open ScrollableView"
    3) Click on "Click me then look a the log!"
    4) Look at the log and you should see two entries for setting the paging control. This would result in a exception before.

    Thanks
    Opie

  4. Don Thorp 2011-04-15

    Verified on G1/1.6 and Nexus One/2.2.1 using build #e1cb22a

    Used scrollable view test.

JSON Source