grote / Transportr

Free Public Transport Assistant without Ads or Tracking
https://transportr.app
GNU General Public License v3.0
1.02k stars 185 forks source link

Crash / NPE when viewing a trip with missing line style #16

Closed Paspartout closed 10 years ago

Paspartout commented 10 years ago

Steps to reproduce

  1. Open Liberario, go to your favorite trips tab, and select / view one of your trips
  2. Go back and select another favorite trip
  3. Crash / NPE

    Logcat

I/ActivityManager(  537): START u0 {cmp=de.grobox.liberario/.TripsActivity (has extras)} from pid 2900
D/dalvikvm(  537): GC_FOR_ALLOC freed 3895K, 32% free 23390K/34208K, paused 101ms, total 102ms
W/InputMethodManagerService(  537): Focus gain on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@41d3f4c0 (uid=10095 pid=2900)
D/PullToRefresh( 2900): Setting Padding. L: 0, T: 0, R: 0, B: 0
D/PullToRefresh( 2900): addView: TableLayout
D/AndroidRuntime( 2900): Shutting down VM
W/dalvikvm( 2900): threadid=1: thread exiting with uncaught exception (group=0x41510700)
E/AndroidRuntime( 2900): FATAL EXCEPTION: main
E/AndroidRuntime( 2900): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.grobox.liberario/de.grobox.liberario.TripsActivity}: java.lang.NullPointerException
E/AndroidRuntime( 2900):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2350)
E/AndroidRuntime( 2900):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2400)
E/AndroidRuntime( 2900):    at android.app.ActivityThread.access$600(ActivityThread.java:153)
E/AndroidRuntime( 2900):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269)
E/AndroidRuntime( 2900):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2900):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2900):    at android.app.ActivityThread.main(ActivityThread.java:5295)
E/AndroidRuntime( 2900):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2900):    at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime( 2900):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
E/AndroidRuntime( 2900):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
E/AndroidRuntime( 2900):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2900): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 2900):    at de.grobox.liberario.TripsActivity.addLineBox(TripsActivity.java:276)
E/AndroidRuntime( 2900):    at de.grobox.liberario.TripsActivity.addLineBox(TripsActivity.java:303)
E/AndroidRuntime( 2900):    at de.grobox.liberario.TripsActivity.addLineBox(TripsActivity.java:295)
E/AndroidRuntime( 2900):    at de.grobox.liberario.TripsActivity.addTrips(TripsActivity.java:225)
E/AndroidRuntime( 2900):    at de.grobox.liberario.TripsActivity.addTrips(TripsActivity.java:322)
E/AndroidRuntime( 2900):    at de.grobox.liberario.TripsActivity.onCreate(TripsActivity.java:86)
E/AndroidRuntime( 2900):    at android.app.Activity.performCreate(Activity.java:5248)
E/AndroidRuntime( 2900):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 2900):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2304)
E/AndroidRuntime( 2900):    ... 11 more
W/ActivityManager(  537):   Force finishing activity de.grobox.liberario/.TripsActivity
W/ActivityManager(  537):   Force finishing activity de.grobox.liberario/.MainActivity
I/auditd  ( 3024): Starting up
E/auditd  ( 3024): Failed on audit_set_pid with error: Protocol not supported
I/auditd  ( 3024): Exiting
W/DropBoxManagerService(  537): Dropping: data_app_crash (1771 > 0 bytes)

BTW: Thanks for Liberario, its awesome :D

grote commented 10 years ago

Thanks for the great bug report! :)

However, I don't think it can be reproduced as stated. Looks more like one of your favorite trips contains a line that has no color defined. Could you please provide the trip and the transport network?

Paspartout commented 10 years ago

Thanks for your fast response and you were right.

I am using the DB(Deutsche Bahn) Provider for my local public transport, which usually works fine. In this one case here the trip shows a special / rare product called AST(Anrufsammeltaxi), which seems not to be handled by your app / public transport enabler.

Maybe it is a good idea to provide a default color to the apps line boxes, in case there is no color provided by your app / public transport enabler.

grote commented 10 years ago

Do you have an example for a trip that includes this AST? It does not have to be the real trip you are using in your area. Any example that causes the issue works for me testing a fix and a default color.

Paspartout commented 10 years ago

Yes, here you go:

If you are about to add the colors for the AST here is an its icon.

grote commented 10 years ago

I now handled the missing AST style to prevent crashes and passed the style issue to upstream.

schildbach commented 10 years ago

Yes, I guess that's the right fix. Lines are not guaranteed to have a style.

Paspartout commented 10 years ago

Okay thanks for that really fast fix. I am looking forward to the next version of Liberario :)