durur / robertprojects

Automatically exported from code.google.com/p/robertprojects
0 stars 0 forks source link

NullPointerException (NPE) in com.robert.maps.applib.MainActivity #139

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Dear RMaps Team,

I have implemented an static analysis tool for finding bugs in Android apps and 
I have found a NullPointerException (NPE) in the following class of your app:
- com.robert.maps.applib.MainActivity

What steps will reproduce the problem?
1. Open the app and stay in the main activity.
2. Tab the menu button.
5. Tab the home button and before the window closes, tab the Exit button in the 
menu.

This will create a NPE in the activity. It is worth to mention that there are 
other scenarios in which this bug can be seen. For example, if the user repeat 
the first 3 steps and receives a phone call, but before the phone call activity 
takes the foreground, the user tabs the Exit button. This creates a race 
condition between the callbacks onPause and onOptionsItemSelected (onPause is 
called before onOptionsItemSelected). Other apps have had this problem as you 
can see in bug found in MyTracks [1].

What is the expected output? What do you see instead?
The app crashes. The app must not crash and maintain the same state when the 
user comeback to the app.

What version of the product are you using? On what operating system?
0.9.4.1 on a Samsung S4 Mini with Android 4.2.2.

Please provide any additional information below.
RMaps: 0.9.1
Android: 4.4.2
Device: MSM8960 samsung serranoltespr SPH-L520 serranoltespr

java.lang.NullPointerException
at com.robert.maps.applib.MainActivity.onPause(MainActivity.java:633)
at 
com.robert.maps.applib.MainActivity.onOptionsItemSelected(MainActivity.java:812)
at android.app.Activity.onMenuItemSelected(Activity.java:2708)
at 
com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java
:1110)
at 
com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.
java:735)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
at 
com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:87
4)
at 
com.android.internal.view.menu.ListMenuPresenter.onItemClick(ListMenuPresenter.j
ava:177)
at android.widget.AdapterView.performItemClick(AdapterView.java:308)
at android.widget.AbsListView.performItemClick(AbsListView.java:1509)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3467)
at android.widget.AbsListView$3.run(AbsListView.java:4830)
at android.widget.AbsListView.onDetachedFromWindow(AbsListView.java:3297)
at 
com.android.internal.view.menu.ExpandedMenuView.onDetachedFromWindow(ExpandedMen
uView.java:96)
at android.view.View.dispatchDetachedFromWindow(View.java:13557)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2802)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2800)
at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3352)
at android.view.ViewRootImpl.doDie(ViewRootImpl.java:6217)
at 
android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3741)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)

Original issue reported on code.google.com by danilo.d...@gmail.com on 20 Aug 2014 at 3:02

GoogleCodeExporter commented 8 years ago
[1] 
https://code.google.com/p/mytracks/issues/detail?id=741&can=1&q=status%3AFixed&s
ort=id&colspec=ID%20Type%20Component%20Status%20Priority%20Targeting%20Work%20St
ars%20Owner%20Summary&start=200

Original comment by danilo.d...@gmail.com on 20 Aug 2014 at 5:09