Stypox / dicio-android

Dicio assistant app for Android
GNU General Public License v3.0
726 stars 69 forks source link

Crash when timer isn't visible (Dicio 0.6) #61

Closed TheLastProject closed 2 years ago

TheLastProject commented 2 years ago

Hey there,

Thanks for Dicio 0.6! I'm glad to have a timer feature, which is the main feature I use in voice assistants :)

Sadly, the timer feature is quite easy to break. If you set a timer, click settings and then click back the app's state resets and a crash will happen on the next TTS update:

FATAL EXCEPTION: main
Process: org.dicio.dicio_android, PID: 24891
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.speech.tts.TextToSpeech.speak(java.lang.CharSequence, int, android.os.Bundle, java.lang.String)' on a null object reference
 at org.dicio.dicio_android.output.speech.AndroidTtsSpeechDevice.speak([AndroidTtsSpeechDevice.java:71](https://androidttsspeechdevice.java:71/))
 at org.dicio.dicio_android.skills.timer.TimerOutput.lambda$setTimer$0$TimerOutput([TimerOutput.java:243](https://timeroutput.java:243/))
 at org.dicio.dicio_android.skills.timer.-$$Lambda$TimerOutput$JVQKXD3e0_QZmKL-N9F6BPYovhc.accept(Unknown Source:14)
 at org.dicio.dicio_android.skills.timer.TimerOutput$SetTimer$1.onTick([TimerOutput.java:74](https://timeroutput.java:74/))
 at android.os.CountDownTimer$1.handleMessage([CountDownTimer.java:130](https://countdowntimer.java:130/))
 at android.os.Handler.dispatchMessage([Handler.java:106](https://handler.java:106/))
 at android.os.Looper.loop([Looper.java:223](https://looper.java:223/))
 at android.app.ActivityThread.main([ActivityThread.java:7664](https://activitythread.java:7664/))
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$[MethodAndArgsCaller.run](https://methodandargscaller.run/)([RuntimeInit.java:592](https://runtimeinit.java:592/))
 at com.android.internal.os.ZygoteInit.main([ZygoteInit.java:947](https://zygoteinit.java:947/))

https://user-images.githubusercontent.com/1885159/157658095-0cabf13f-8ba1-4395-8c01-5ae6c5221179.mp4

(Please ignore the Dicio notification, this comes from Scoop which I personally find the easiest way to collect stack traces, it doesn't come from your app)

Stypox commented 2 years ago

I followed your steps and found out I already accidentally fixed this in #60, next version will contain the fix ;-) Anyway, the timer implementation is still pretty bulky, it will take me some time to do it properly :-)

TheLastProject commented 2 years ago

Haha, nice. Well, bug solved then :)