A java.lang.NullPointerException at SearchListWindow.java:174
In the current version 2.0.22, our automated app testing tool detected a NullPointerException.
The below is the logcat report:
E/SQLiteLog( 5511): (1) no such column: fontsize
E/AndroidRuntime( 5511): FATAL EXCEPTION: main
E/AndroidRuntime( 5511): Process: a3e.process, PID: 5511
E/AndroidRuntime( 5511): java.lang.NullPointerException: storage == null
E/AndroidRuntime( 5511): at java.util.Arrays$ArrayList.
Same bug still exists in version 2.0.27, which is discovered by our tool.
Version
2.0.27
Device
Nexus 6 (Emulator)
Reproduction step
- Break the network (e.g., close the network)
- In main page, random select an category entry, and enter its detailed page
- Wait until the detailed page shows the error message (e.g., Error
java.net.UnknownHostException, ...), 4, Click the menu button (top-right button) - Click either
Increase FontorDecrease Font. - The app crashed
Stack Trace
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3741)
at java.util.Arrays.asList(Arrays.java:3728)
at android.widget.ArrayAdapter.<init>(ArrayAdapter.java:163)
at com.commonsware.android.arXiv.SearchListWindow$myCustomAdapter.<init>(SearchListWindow.java:127)
at com.commonsware.android.arXiv.SearchListWindow$1.handleMessage(SearchListWindow.java:174)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:108)
Rational
When network is broken, the listText field of SearchListWindow remains null due to exception occurs at line 273, which leads to the non-null checking when myCustomAdapter is created at line 174.