vmiklos / plees-tracker

Plees Tracker is a simple sleep tracker for your Android phone.
https://vmiklos.hu/plees-tracker/
MIT License
151 stars 38 forks source link

Export to file: avoid reporting success in toast on failure #408

Closed vmiklos closed 9 months ago

vmiklos commented 9 months ago

It turns out openOutputStream() can throw an exception, which is not obvious at first, since it returns a nullable output stream, so first I assumed that it returns a null output stream on failure.

Also, given that it was assumed export can't reach showing a toast on failure, we always presented success. Fix this and report an error on failure.

Fixes https://github.com/vmiklos/plees-tracker/issues/406.

Change-Id: Ic5922e4b38f544debe0888bd636d21be8fe35f49