paulmach / Text-Edit-for-Android

THIS APP IS NO LONGER BEING DEVELOPED. Simple notepad app for the Android OS that can open, edit and save text files to and from the SD card.
http://textedit.paulmach.com
GNU General Public License v3.0
99 stars 55 forks source link

A NullPointerException bug #9

Open tingsu opened 8 years ago

tingsu commented 8 years ago

Hi, thanks for developing this useful app. We recently tested this app by an automated Android GUI testing tool developed by our research team. We found the app could run into a "NullPointerException" error after executing the following actions:

start the app -> press "menu" key -> choose the "open" menu item -> delete the original file name "/sdcard/" in the EditText on the appearing dialog titled with "Open File" -> fill in "test" in the EditText -> click "open" -> click "continue" button on the appearing dialog titled with "test not found" -> the app crashed

Here is the log:

W/dalvikvm( 1076): threadid=1: thread exiting with uncaught exception (group=0x40a13300) E/AndroidRuntime( 1076): FATAL EXCEPTION: main E/AndroidRuntime( 1076): java.lang.NullPointerException E/AndroidRuntime( 1076): at org.paulmach.textedit.pmTextEdit.onPrepareDialog(pmTextEdit.java:951) E/AndroidRuntime( 1076): at android.app.Activity.onPrepareDialog(Activity.java:2988) E/AndroidRuntime( 1076): at android.app.Activity.showDialog(Activity.java:3051) E/AndroidRuntime( 1076): at android.app.Activity.showDialog(Activity.java:3002) E/AndroidRuntime( 1076): at org.paulmach.textedit.pmTextEdit$15.onClick(pmTextEdit.java:1329) E/AndroidRuntime( 1076): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166) E/AndroidRuntime( 1076): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 1076): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime( 1076): at android.app.ActivityThread.main(ActivityThread.java:4745) E/AndroidRuntime( 1076): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 1076): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime( 1076): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) E/AndroidRuntime( 1076): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) E/AndroidRuntime( 1076): at dalvik.system.NativeStart.main(Native Method) W/ActivityManager( 150): Force finishing activity org.paulmach.textedit/.pmTextEdit

We carefully inspected the source code, and found the root cause lies in the following code (in "pmTextEdit.java" file)

screen shot 2016-04-13 at 7 56 45 pm

Could you please take a look and confirm this bug? Thanks! Ting Su

tingsu commented 8 years ago

Some updates: we have sent an email to the app author, and the bug has been confirmed.