agwells / dotdash-keyboard-android

The world's most popular open source Morse code keyboard for Android! (probably)
GNU General Public License v3.0
32 stars 5 forks source link

java.lang.NullPointerException at net.iowaline.dotdash.DotDashIMEService.updateCapsLockKey(DotDashIMEService.java:389) #17

Closed agwells closed 8 years ago

agwells commented 9 years ago

Reported in the Android Developer Console crash report tool. 13 reports of it, all listed as being by a Galaxy Note2, so presumably it's just affecting one user.

Last reported: May 9, 12:48 AM App version: 1.1.6 Android version: Android 4.1 Device: Galaxy Note2 (t0ltetmo)

java.lang.NullPointerException at net.iowaline.dotdash.DotDashIMEService.updateCapsLockKey(DotDashIMEService.java:389) at net.iowaline.dotdash.DotDashIMEService.updateAutoCap(DotDashIMEService.java:530) at net.iowaline.dotdash.DotDashIMEService.onUpdateSelection(DotDashIMEService.java:500) at android.inputmethodservice.InputMethodService$InputMethodSessionImpl.updateSelection(InputMethodService.java:592) at android.inputmethodservice.IInputMethodSessionWrapper.executeMessage(IInputMethodSessionWrapper.java:113) at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4898) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775) at dalvik.system.NativeStart.main(Native Method)

agwells commented 9 years ago

Hm, it's caused by a call to the onUpdateSelection method. This is the method that gets called when the cursor moves around, so in response I change the state of the auto-cap, if you're using that feature.

I can't replicate the bug by fiddling with selection and the shift button, though. Maybe it's a 4.1 thing?

agwells commented 8 years ago

Got some more detailed crash reports from Android 5. It tells me specifically which line of the method the problem was in. Looks like it's the call to this.inputView.invalidateKey(). Apparently sometimes this method gets invoke when this.inputView is null. Weird. Anyway, I already had a try-catch block around it for an exception that was sometimes being thrown by Android 2.2. I broadened that to a general "catch Exception", which should prevent the crash at least.

Application version: 14 Android version: Android 5.0 Device :Galaxy Note3 (hltetmo)

java.lang.NullPointerException: Attempt to invoke virtual method 'void net.iowaline.dotdash.DotDashKeyboardView.invalidateKey(int)' on a null object reference at net.iowaline.dotdash.DotDashIMEService.updateCapsLockKey(DotDashIMEService.java:405) at net.iowaline.dotdash.DotDashIMEService.updateAutoCap(DotDashIMEService.java:546) at net.iowaline.dotdash.DotDashIMEService.onUpdateSelection(DotDashIMEService.java:516) at android.inputmethodservice.InputMethodService$InputMethodSessionImpl.updateSelection(InputMethodService.java:718) at android.inputmethodservice.IInputMethodSessionWrapper.executeMessage(IInputMethodSessionWrapper.java:108) at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5944) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)